goldentest

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForMarshaling

type ForMarshaling Test

This absurdity is a workaround for a bug github.com/go-yaml/yaml/issues/817 in the YAML library. We want to inline a Test in a WithHeader when marshaling. But the bug prevents that, because anything that implements Unmarshaler cannot be inlined. As a workaround, we create a new type with the same fields but without the Unmarshal method.

type Test

type Test struct {
	// Pos is the YAML file location where this object started.
	Pos model.ConfigPos `yaml:"-"`

	Inputs      []*VarValue `yaml:"inputs,omitempty"`
	BuiltinVars []*VarValue `yaml:"builtin_vars,omitempty"`
	// Features configures which features to use depending on goldentest API version.
	Features features.Features `yaml:"-"`
}

Test represents a parsed test.yaml describing test configs.

func (*Test) UnmarshalYAML

func (t *Test) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*Test) Upgrade

func (t *Test) Upgrade(ctx context.Context) (model.ValidatorUpgrader, error)

Upgrade implements model.ValidatorUpgrader.

func (*Test) Validate

func (t *Test) Validate() error

Validate implements model.Validator.

type VarValue

type VarValue struct {
	// Pos is the YAML file location where this object started.
	Pos model.ConfigPos `yaml:"-"`

	Name  model.String `yaml:"name"`
	Value model.String `yaml:"value"`
}

VarValue represents one of the parsed "input" fields from the inputs.yaml file.

func (*VarValue) UnmarshalYAML

func (i *VarValue) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*VarValue) Validate

func (i *VarValue) Validate() error

type WithHeader

type WithHeader header.With[*ForMarshaling]

This absurdity is a workaround for a bug github.com/go-yaml/yaml/issues/817 in the YAML library. We want to inline a Test in a WithHeader when marshaling. But the bug prevents that, because anything that implements Unmarshaler cannot be inlined. As a workaround, we create a new type with the same fields but without the Unmarshal method.

Jump to

Keyboard shortcuts

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