File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2140,4 +2140,54 @@ type FunctionValue struct {
21402140type NativeFunction func(args []shared.RuntimeValue, env *environment.Environment) (*shared.RuntimeValue, *errors.RuntimeError)
21412141` ` `
21422142
2143+ # testhelpers
2144+
2145+ ` ` ` go
2146+ import "github.com/dev-kas/virtlang-go/v4/internal/testhelpers"
2147+ ` ` `
2148+
2149+ ## Index
2150+
2151+ - [func EvalNode \(t \*testing.T , node ast.Expr \) \*shared.RuntimeValue ](<#EvalNode>)
2152+ - [func ExpectParseError \(t \*testing.T , src string \)](<#ExpectParseError>)
2153+ - [func MustEval \(t \*testing.T , src string \) \*shared.RuntimeValue ](<#MustEval>)
2154+ - [func MustParse \(t \*testing.T , src string \) \*ast.Program ](<#MustParse>)
2155+
2156+
2157+ <a name=" EvalNode" ></a>
2158+ ## func EvalNode
2159+
2160+ ` ` ` go
2161+ func EvalNode(t *testing.T, node ast.Expr) *shared.RuntimeValue
2162+ ` ` `
2163+
2164+ EvalNode evaluates a manually constructed AST node directly
2165+
2166+ <a name=" ExpectParseError" ></a>
2167+ ## func ExpectParseError
2168+
2169+ ` ` ` go
2170+ func ExpectParseError(t *testing.T, src string)
2171+ ` ` `
2172+
2173+ ExpectParseError checks that parsing fails for invalid sources
2174+
2175+ <a name=" MustEval" ></a>
2176+ ## func MustEval
2177+
2178+ ` ` ` go
2179+ func MustEval(t *testing.T, src string) *shared.RuntimeValue
2180+ ` ` `
2181+
2182+ MustEval evaluates source code fully \(parse \-\> eval\) and returns the value
2183+
2184+ <a name=" MustParse" ></a>
2185+ ## func MustParse
2186+
2187+ ` ` ` go
2188+ func MustParse(t *testing.T, src string) *ast.Program
2189+ ` ` `
2190+
2191+ MustParse parses source code and returns AST program or fails the test
2192+
21432193Generated by [gomarkdoc](<https:// github.com/princjef/gomarkdoc>)
You can’t perform that action at this time.
0 commit comments