testutil

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package testutil provides helper functions for testing jscan components

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqual

func AssertEqual(t *testing.T, expected, actual any)

AssertEqual fails the test if expected != actual

func AssertError

func AssertError(t *testing.T, err error)

AssertError fails the test if err is nil

func AssertFalse

func AssertFalse(t *testing.T, condition bool, msg string)

AssertFalse fails the test if condition is true

func AssertNil

func AssertNil(t *testing.T, value any)

AssertNil fails the test if value is not nil

func AssertNoError

func AssertNoError(t *testing.T, err error)

AssertNoError fails the test if err is not nil

func AssertNotNil

func AssertNotNil(t *testing.T, value any)

AssertNotNil fails the test if value is nil

func AssertTrue

func AssertTrue(t *testing.T, condition bool, msg string)

AssertTrue fails the test if condition is false

func CountFunctionsInAST

func CountFunctionsInAST(ast *parser.Node) int

CountFunctionsInAST counts the number of functions in an AST

func CountNodesOfType

func CountNodesOfType(ast *parser.Node, nodeType parser.NodeType) int

CountNodesOfType counts nodes of a specific type in an AST

func CreateTestAST

func CreateTestAST(t *testing.T, source string) *parser.Node

CreateTestAST creates a test AST from JavaScript source code

func CreateTestASTNoFail

func CreateTestASTNoFail(source string) (*parser.Node, error)

CreateTestASTNoFail creates a test AST, returning nil on error instead of failing

func FindFunctionInAST

func FindFunctionInAST(ast *parser.Node, name string) *parser.Node

FindFunctionInAST finds a function node by name in the AST

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL