test

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PositiveTestCases  = "cases/positive_tests.json"
	NegativeTestCases  = "cases/negative_tests.json"
	FilteringTestCases = "cases/filtering_tests.json"
	MutationTestCases  = "cases/mutation_tests.json"
)

Variables

This section is empty.

Functions

func CypherToCypher

func CypherToCypher(ctx *frontend.Context, input string) (string, error)

func UnmarshallTestCaseDetails

func UnmarshallTestCaseDetails[T any](testCase Case) (T, error)

func UpdatePositiveTestCasesFitness

func UpdatePositiveTestCasesFitness() error

Types

type Case

type Case struct {
	Name     string          `json:"name"`
	Type     Type            `json:"type"`
	Targeted bool            `json:"targeted,omitempty"`
	Ignore   bool            `json:"ignore,omitempty"`
	Details  json.RawMessage `json:"details"`
}

func (Case) MarshalDetails

func (s Case) MarshalDetails(target any) error

type Cases

type Cases struct {
	TestCases []Case `json:"test_cases"`
}

func LoadFixture

func LoadFixture(t *testing.T, filename string) Cases

func (Cases) Run

func (s Cases) Run(t *testing.T)

func (Cases) RunnableCases

func (s Cases) RunnableCases() []Case

type Emitter

type Emitter interface {
	Write(query *cypher.RegularQuery, writer io.Writer) error
	WriteExpression(output io.Writer, expression cypher.Expression) error
}

type NegativeTest

type NegativeTest struct {
	Queries       []string `json:"queries"`
	ErrorMatchers []string `json:"error_matchers"`
}

func (NegativeTest) Run

func (s NegativeTest) Run(t *testing.T, testCase Case)

type Runner

type Runner interface {
	Run(t *testing.T, testCase Case)
}

type StringMatchTest

type StringMatchTest struct {
	Query           string `json:"query"`
	Matcher         string `json:"matcher,omitempty"`
	ExpectedFitness *int64 `json:"fitness"`
}

func (StringMatchTest) Run

func (s StringMatchTest) Run(t *testing.T, testCase Case)

type Type

type Type = string
const (
	TypeStringMatch  Type = "string_match"
	TypeNegativeCase Type = "negative_case"
)

Jump to

Keyboard shortcuts

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