ssatest

package
v1.3.5-alpha0802 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(
	t *testing.T, code string,
	handler func(prog *ssaapi.Program) error,
	opt ...ssaapi.Option,
)

func CheckBottomUserCall_Contain

func CheckBottomUserCall_Contain(variable string, want []string, forceCheckLength ...bool) checkFunction

func CheckBottomUser_Contain

func CheckBottomUser_Contain(variable string, want []string, forceCheckLength ...bool) checkFunction

func CheckError

func CheckError(t *testing.T, tc TestCase)

func CheckFSWithProgram

func CheckFSWithProgram(
	t *testing.T, programName string,
	codeFS, ruleFS fi.FileSystem, opt ...ssaapi.Option,
)

func CheckFreeValue

func CheckFreeValue(t *testing.T, tc TestCase)

func CheckFunctionReturnType

func CheckFunctionReturnType(t *testing.T, code string, kind ssa.TypeKind)

func CheckMask

func CheckMask(t *testing.T, tc TestCase)

func CheckNoError

func CheckNoError(t *testing.T, code string, opt ...ssaapi.Option)

func CheckParameter

func CheckParameter(t *testing.T, tc TestCase)

func CheckParameterMember

func CheckParameterMember(t *testing.T, tc TestCase)

func CheckParse

func CheckParse(t *testing.T, code string, opt ...ssaapi.Option)

func CheckPrintf

func CheckPrintf(t *testing.T, tc TestCase)

func CheckPrintlnValue

func CheckPrintlnValue(code string, want []string, t *testing.T)

--------------------- for test ---------------------

func CheckSyntaxFlow

func CheckSyntaxFlow(t *testing.T, code string, sf string, wants map[string][]string, opt ...ssaapi.Option)

func CheckSyntaxFlowContain

func CheckSyntaxFlowContain(t *testing.T, code string, sf string, wants map[string][]string, opt ...ssaapi.Option)

func CheckSyntaxFlowEx

func CheckSyntaxFlowEx(t *testing.T, code string, sf string, contain bool, wants map[string][]string, opt ...ssaapi.Option)

func CheckSyntaxFlowWithFS

func CheckSyntaxFlowWithFS(t *testing.T, fs fi.FileSystem, sf string, wants map[string][]string, contain bool, opt ...ssaapi.Option)

func CheckSyntaxFlowWithSFOption

func CheckSyntaxFlowWithSFOption(t *testing.T, code string, sf string, wants map[string][]string, opt ...sfvm.Option)

func CheckTestCase

func CheckTestCase(t *testing.T, tc TestCase)

func CheckTopDef_Contain

func CheckTopDef_Contain(variable string, want []string, forceCheckLength ...bool) checkFunction

func CheckTopDef_Equal

func CheckTopDef_Equal(variable string, want []string, forceCheckLength ...bool) checkFunction

func CheckType

func CheckType(t *testing.T, code string, typ ssa.Type, opt ...ssaapi.Option)

func CheckTypeKind

func CheckTypeKind(t *testing.T, code string, kind ssa.TypeKind, opt ...ssaapi.Option)

func CheckWithFS

func CheckWithFS(fs fi.FileSystem, t *testing.T, handler func(ssaapi.Programs) error, opt ...ssaapi.Option)

func CheckWithName

func CheckWithName(
	name string,
	t *testing.T, code string,
	handler func(prog *ssaapi.Program) error,
	opt ...ssaapi.Option,
)

func CompareResult

func CompareResult(t *testing.T, contain bool, results *ssaapi.SyntaxFlowResult, wants map[string][]string)

func MockSSA

func MockSSA(t *testing.T, src string)

func ProfileJavaCheck

func ProfileJavaCheck(t *testing.T, code string, handler func(inMemory bool, prog *ssaapi.Program, start time.Time) error, opt ...ssaapi.Option)

func SetLanguage

func SetLanguage(lang consts.Language, build ssa.Builder)

Types

type ExampleInterface

type ExampleInterface interface {
	ExampleMethod()
}

===================== struct =====================

func GetExampleInterface

func GetExampleInterface() ExampleInterface

type ExampleStruct

type ExampleStruct struct {
	ExampleFieldFunction func()
}

func GetExampleStruct

func GetExampleStruct() ExampleStruct

func (ExampleStruct) ExampleMethod

func (a ExampleStruct) ExampleMethod()

type TestCase

type TestCase struct {
	Code        string
	Want        []string
	ExternValue map[string]any
	ExternLib   map[string]map[string]any
	Check       func(*ssaapi.Program, []string)
	Option      []ssaapi.Option
}

===================== test case ====================

Jump to

Keyboard shortcuts

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