Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertionPackage ¶
type AssertionPackage struct {
Tool string
Header string
Package string
DocString string
Copyright string
Receiver string
TestDataPath string
Imports ImportMap
EnableFormat bool
EnableForward bool
EnableGenerics bool
EnableExamples bool
RunnableExamples bool
Functions []Function
Types []Ident
Consts []Ident
Vars []Ident
// extraneous information when scanning in collectDoc mode
ExtraComments []ExtraComment
}
AssertionPackage describes the internal/assertions package.
func (*AssertionPackage) Clone ¶
func (a *AssertionPackage) Clone() *AssertionPackage
func (*AssertionPackage) HasHelpers ¶
func (a *AssertionPackage) HasHelpers() (ok bool)
type CommentTag ¶
type CommentTag uint8
const ( CommentTagNone CommentTag = iota CommentTagDomain CommentTagMaintainer CommentTagMention CommentTagNote CommentTagDomainDescription )
type Document ¶
type Document struct {
Title string
Domain string
Description string
Path string // document folder, relative to its parent if any
File string // document name, e.g. _index.md, string.md
GitHubURL string
PkgGoDevURL string
Kind KindDoc // page or index or folder
Documents []Document // for folders, their content [Document]
Index []IndexEntry // for indexes, their entry list
Package *AssertionPackage // subset of the package that pertains to this document
ExtraPackages ExtraPackages
RefCount int
Weight int
}
func (Document) HasGenerics ¶ added in v2.2.0
type Documentation ¶
type Documentation struct {
Package *AssertionPackage // the complete source package being documented
Documents []Document // Documents is a collection of markdown pages or folders
}
func NewDocumentation ¶
func NewDocumentation() *Documentation
NewDocumentation builds an empty Documentation.
func (*Documentation) Merge ¶
func (d *Documentation) Merge(doc Documentation)
type ExtraComment ¶
type ExtraComment struct {
Tag CommentTag
Key string
Text string
}
type ExtraPackages ¶
type ExtraPackages []*AssertionPackage
func (ExtraPackages) LookupFunction ¶
func (pkgs ExtraPackages) LookupFunction(name string) []FunctionWithContext
type Function ¶
type Function struct {
ID string
Name string
SourcePackage string
TargetPackage string
DocString string
UseMock string
Params Parameters
AllParams Parameters
Returns Parameters
TypeParams []TypeParam
IsGeneric bool
IsHelper bool
IsDeprecated bool
IsConstructor bool
Tests []Test
// extraneous information when scanning in collectDoc mode
Domain string
SourceLink *token.Position
ExtraComments []ExtraComment
}
Function represents an assertion function extracted from the source package.
func (Function) GenericCallName ¶ added in v2.2.0
GenericCallName renders the function name with explicit type parameters. This is used when forwarding type parameters, as all type parameters may not be always infered from the arguments.
func (Function) GenericName ¶ added in v2.2.0
GenericName renders the function name with one or more suffixes, accounting for any type parameter for generic functions.
func (Function) HasSuccessTest ¶
type FunctionWithContext ¶
type Ident ¶
type Ident struct {
ID string
Name string
SourcePackage string
TargetPackage string
DocString string
IsAlias bool
IsDeprecated bool
Function *Function // for function types (or vars)
// extraneous information when scanning in collectDoc mode
Domain string
SourceLink *token.Position
ExtraComments []ExtraComment
}
Ident represents an exported identifier (type, constant, or variable) from the source package.
type ImportMap ¶
ImportMap represents the imports for the analyzed package.
func (ImportMap) HasImports ¶
type IndexEntry ¶
type Parameters ¶
type Parameters []Parameter
type Test ¶
type Test struct {
TestedValue string // DEPRECATED: Original raw string, kept for backward compatibility
TestedValues []TestValue // Parsed test value expressions
ExpectedOutcome TestExpectedOutcome // Expected test outcome (success/failure/panic)
AssertionMessage string // Optional assertion message for panic tests
}
Test captures test values to use with generated tests.
Test values are parsed as Go expressions and stored with their AST representation.
type TestExpectedOutcome ¶
type TestExpectedOutcome uint8
const ( TestNone TestExpectedOutcome = iota TestSuccess TestFailure TestPanic )
type TestValue ¶
type TestValue struct {
Raw string // Original string from doc comment
Expr ast.Expr // Parsed Go expression (nil if parse failed)
Error error // Parse error if any
}
TestValue represents a single parsed test value expression.
It stores both the original string (for debugging/audit) and the parsed AST.