Documentation
¶
Overview ¶
Package testutil provides helper functions for testing jscan components
Index ¶
- func AssertEqual(t *testing.T, expected, actual any)
- func AssertError(t *testing.T, err error)
- func AssertFalse(t *testing.T, condition bool, msg string)
- func AssertNil(t *testing.T, value any)
- func AssertNoError(t *testing.T, err error)
- func AssertNotNil(t *testing.T, value any)
- func AssertTrue(t *testing.T, condition bool, msg string)
- func CountFunctionsInAST(ast *parser.Node) int
- func CountNodesOfType(ast *parser.Node, nodeType parser.NodeType) int
- func CreateTestAST(t *testing.T, source string) *parser.Node
- func CreateTestASTNoFail(source string) (*parser.Node, error)
- func FindFunctionInAST(ast *parser.Node, name string) *parser.Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
AssertEqual fails the test if expected != actual
func AssertError ¶
AssertError fails the test if err is nil
func AssertFalse ¶
AssertFalse fails the test if condition is true
func AssertNoError ¶
AssertNoError fails the test if err is not nil
func AssertNotNil ¶
AssertNotNil fails the test if value is nil
func AssertTrue ¶
AssertTrue fails the test if condition is false
func CountFunctionsInAST ¶
CountFunctionsInAST counts the number of functions in an AST
func CountNodesOfType ¶
CountNodesOfType counts nodes of a specific type in an AST
func CreateTestAST ¶
CreateTestAST creates a test AST from JavaScript source code
func CreateTestASTNoFail ¶
CreateTestASTNoFail creates a test AST, returning nil on error instead of failing
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.