externaltest

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("no external JSON schema tests found")

Functions

func ReadTestDir

func ReadTestDir(dir string) (tests map[string][]*Schema, err error)

ReadTestDir reads all the external tests from the given directory.

func WriteTestDir

func WriteTestDir(dir string, tests map[string][]*Schema) error

WriteTestDir writes test data files as read by ReadTestDir to the given directory. The keys of tests are filenames relative to dir.

Types

type Schema

type Schema struct {
	Description string             `json:"description"`
	Comment     string             `json:"comment,omitempty"`
	Schema      stdjson.RawMessage `json:"schema"`
	Skip        Skip               `json:"skip,omitempty"`
	Tests       []*Test            `json:"tests"`
	// contains filtered or unexported fields
}

func (Schema) Pos

func (loc Schema) Pos() token.Pos

type Skip

type Skip map[string]string

Skip records information about whether a given schema or test will be skipped when testing. If not present, the test will be expected to pass.

Each key in the map represents the name of a point in the cuetdtest matrix.

type Test

type Test struct {
	Description string             `json:"description"`
	Comment     string             `json:"comment,omitempty"`
	Data        stdjson.RawMessage `json:"data"`
	Valid       bool               `json:"valid"`
	Skip        Skip               `json:"skip,omitempty"`
	// contains filtered or unexported fields
}

func (Test) Pos

func (loc Test) Pos() token.Pos

Jump to

Keyboard shortcuts

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