testing

package
v0.0.0-...-e4c065d Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArbitraryRegexp

func ArbitraryRegexp(rnd *rand.Rand, maxDeep, maxSize int) ohsnap.Arbitrary[TestRegexp]

func ToScanOption

func ToScanOption(x string) (node.ScanOption, error)

func ToScanOptions

func ToScanOptions(xs ...string) ([]node.ScanOption, error)

Types

type Expectation

type Expectation struct {
	SubString   string
	Span        Span
	Expressions []string
	Groups      []Group      `json:",omitempty"`
	NamedGroups []NamedGroup `json:",omitempty"`
}

func TestMatchesToExpectations

func TestMatchesToExpectations(xs ...*scanner.Match) []*Expectation

func (*Expectation) Normalize

func (ex *Expectation) Normalize()

func (*Expectation) String

func (ex *Expectation) String() string

type Group

type Group struct {
	Span
	OutOfString bool
}

type NamedGroup

type NamedGroup struct {
	Name        string
	Span        Span
	OutOfString bool
}

func (NamedGroup) String

func (g NamedGroup) String() string

type Span

type Span struct {
	From  int
	To    int
	Empty bool
}

func (Span) String

func (s Span) String() string

type Test

type Test struct {
	Name        string
	Expressions []string
	Input       string
	Options     []string
	Want        []*Expectation
}

type TestFile

type TestFile struct {
	Name  string
	Tests []Test
}

func LoadAllTestFiles

func LoadAllTestFiles(t testing.TB, dir string) ([]*TestFile, error)

func LoadTestFile

func LoadTestFile(t testing.TB, path string) (*TestFile, error)

type TestRegexp

type TestRegexp struct {
	Expression    string
	MatchedString string
}

Simplest regexp generator

Jump to

Keyboard shortcuts

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