Documentation
¶
Index ¶
- func ExpectParse(t *testing.T, input string, fn ExpectedFn, opt ...ExpectOpt)
- func ExpectParseError(t *testing.T, input string, e ...[2]string)
- func ExpectParseExpr(t *testing.T, input string, expr node.Expr, opt ...ExpectOpt)
- func ExpectParseMixed(t *testing.T, input string, fn ExpectedFn)
- func ExpectParseMode(t *testing.T, mode parser.Mode, input string, fn ExpectedFn, opt ...ExpectOpt)
- func ExpectParseStmt(t *testing.T, input string, stmt node.Stmt, opt ...ExpectOpt)
- func ExpectParseString(t *testing.T, input, expected string)
- func ExpectParseStringMixed(t *testing.T, input, expected string)
- func ExpectParseStringMode(t *testing.T, mode parser.Mode, input, expected string)
- func ExpectParseStringModeT(t *testing.T, mode parser.Mode, input, expected string, typ any)
- func ExpectParseStringT(t *testing.T, input, expected string, typ any)
- type ExpectOpt
- type ExpectedFn
- type File
- func (f *File) Equal(expected, actual any, msgAndArgs ...any)
- func (f *File) EqualDictElements(expected, actual []*node.DictElementLit)
- func (f *File) EqualExpr(expected, actual node.Expr)
- func (f *File) EqualExprs(expected, actual []node.Expr)
- func (f *File) EqualFuncParams(expected, actual *node.FuncParams)
- func (f *File) EqualFuncType(expected, actual *node.FuncType)
- func (f *File) EqualNamedArgs(expected, actual *node.NamedArgsList)
- func (f *File) EqualNamedArgsNames(expected, actual []*node.NamedArgExpr)
- func (f *File) EqualStmt(expected, actual node.Stmt)
- func (f *File) EqualStmts(expected, actual []node.Stmt)
- func (f *File) EqualTypedIdents(expected, actual []*node.TypedIdentExpr)
- func (f *File) Expect(fn ExpectedFn, post ...PostFileCallback) *File
- func (f *File) File() *parser.File
- type ParseContext
- type Parser
- func (p *Parser) Code(s string, opt ...node.CodeOption) *Parser
- func (p *Parser) Error(e ...[2]string)
- func (p *Parser) File() *File
- func (p *Parser) FormattedCalcCode(s string, maxColumns int, opt ...node.CodeOption) *Parser
- func (p *Parser) FormattedCode(s string, opt ...node.CodeOption) *Parser
- func (p *Parser) GetParserOptions() *parser.ParserOptions
- func (p *Parser) GetScannerOptions() *parser.ScannerOptions
- func (p *Parser) IndentedCode(s string, opt ...node.CodeOption) *Parser
- func (p *Parser) ParseSource(trace io.Writer) (*parser.File, error)
- func (p *Parser) Run(cb ...func(pt *Parser)) *Parser
- func (p *Parser) Stmts(fn ExpectedFn, post ...PostFileCallback) *Parser
- func (p *Parser) String(s string) *Parser
- func (p *Parser) Type(v any) *Parser
- func (p *Parser) WithCodeOptions(opt ...node.CodeOption) *Parser
- func (p *Parser) WithMixed() *Parser
- func (p *Parser) WithMode(m parser.Mode) *Parser
- func (p *Parser) WithParserOptions(f func(opt *parser.ParserOptions)) *Parser
- func (p *Parser) WithScannerOptions(f func(opt *parser.ScannerOptions)) *Parser
- type Pfn
- type PostFileCallback
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectParse ¶
func ExpectParse(t *testing.T, input string, fn ExpectedFn, opt ...ExpectOpt)
func ExpectParseExpr ¶
func ExpectParseMixed ¶
func ExpectParseMixed(t *testing.T, input string, fn ExpectedFn)
func ExpectParseMode ¶
func ExpectParseStmt ¶
func ExpectParseString ¶
func ExpectParseStringMixed ¶
func ExpectParseStringMode ¶
func ExpectParseStringModeT ¶
Types ¶
type ExpectOpt ¶
type ExpectOpt func(ctx *ParseContext)
var OptParseCharAsString ExpectOpt = func(ctx *ParseContext) { ctx.ScannerOptions.Mode |= parser.ScanCharAsString }
type ExpectedFn ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) EqualDictElements ¶
func (f *File) EqualDictElements( expected, actual []*node.DictElementLit, )
func (*File) EqualExprs ¶
func (*File) EqualFuncParams ¶
func (f *File) EqualFuncParams(expected, actual *node.FuncParams)
func (*File) EqualFuncType ¶
func (*File) EqualNamedArgs ¶
func (f *File) EqualNamedArgs(expected, actual *node.NamedArgsList)
func (*File) EqualNamedArgsNames ¶
func (f *File) EqualNamedArgsNames(expected, actual []*node.NamedArgExpr)
func (*File) EqualStmts ¶
func (*File) EqualTypedIdents ¶
func (f *File) EqualTypedIdents(expected, actual []*node.TypedIdentExpr)
func (*File) Expect ¶
func (f *File) Expect(fn ExpectedFn, post ...PostFileCallback) *File
type ParseContext ¶
type ParseContext struct {
ParserOptions *parser.ParserOptions
ScannerOptions *parser.ScannerOptions
PostTests []PostFileCallback
}
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) FormattedCalcCode ¶
FormattedCalcCode formats with the NEW_LINE_CALC column-aware mode and the given max column budget.
func (*Parser) FormattedCode ¶
func (p *Parser) FormattedCode(s string, opt ...node.CodeOption) *Parser
func (*Parser) GetParserOptions ¶
func (p *Parser) GetParserOptions() *parser.ParserOptions
func (*Parser) GetScannerOptions ¶
func (p *Parser) GetScannerOptions() *parser.ScannerOptions
func (*Parser) IndentedCode ¶
func (p *Parser) IndentedCode(s string, opt ...node.CodeOption) *Parser
func (*Parser) Stmts ¶
func (p *Parser) Stmts(fn ExpectedFn, post ...PostFileCallback) *Parser
func (*Parser) WithCodeOptions ¶
func (p *Parser) WithCodeOptions(opt ...node.CodeOption) *Parser
func (*Parser) WithParserOptions ¶
func (p *Parser) WithParserOptions(f func(opt *parser.ParserOptions)) *Parser
func (*Parser) WithScannerOptions ¶
func (p *Parser) WithScannerOptions(f func(opt *parser.ScannerOptions)) *Parser
type PostFileCallback ¶
Click to show internal directories.
Click to hide internal directories.