contract

package
v1.5.14 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package contract runs the shared envrules fixture through any writer's validation function, so every writer proves the same accept and reject result.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, minRan int, writer func(c Case) (refused, skip bool))

Run feeds every case to a writer. The writer reports whether it refused the set, or skip=true when the case does not apply to its shape (for example a single-key writer and a multi-key case). It fails when fewer than minRan ran.

Types

type Case

type Case struct {
	Name         string            `json:"name"`
	Set          map[string]string `json:"set"`
	Existing     envrules.Existing `json:"existing"`
	Policy       json.RawMessage   `json:"policy"`
	Options      envrules.Options  `json:"options"`
	WantErrors   []string          `json:"want_errors"`
	WantWarnings []string          `json:"want_warnings"`
}

Case is one fixture entry.

func Load

func Load(t testing.TB) []Case

Load reads the shared fixture file.

func (Case) DefaultPolicyOnly

func (c Case) DefaultPolicyOnly() bool

DefaultPolicyOnly is true when the case runs under the seeded default policy.

func (Case) Refused

func (c Case) Refused() bool

Refused is what the fixture expects: at least one error.

Jump to

Keyboard shortcuts

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