package externaltest

import "cuelang.org/go/encoding/jsonschema/internal/externaltest"

Index

Variables

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

Source Files

tests.go

Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
11 hours ago

Tools for package owners.