conformance

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package conformance loads and filters ECMA-402 conformance fixtures.

It gives formatter tests one shared representation for skip lists, expected failures, divergences, and product coverage checks.

Only tests and conformance tools should use this package; runtime formatter code must not depend on fixture metadata.

Index

Constants

View Source
const FeatureSupportedLocalesOf = "supportedLocalesOf"

FeatureSupportedLocalesOf is the conformance fixture feature for Intl.<Constructor>.supportedLocalesOf behavior.

Variables

This section is empty.

Functions

func CoverageReport

func CoverageReport(packageRoots []string, skipListPath string) (string, error)

func RunFixtures

func RunFixtures(t *testing.T, root string, run func(*testing.T, Fixture))

func ValidateDivergences

func ValidateDivergences(root string) error

func ValidateFixtureRoots

func ValidateFixtureRoots(roots []string, now time.Time) error

func ValidateNodeWitnessCoverage added in v0.2.8

func ValidateNodeWitnessCoverage(packageRoots []string) error

func ValidateSkipList

func ValidateSkipList(path string, packageRoots []string) error

Types

type Fixture

type Fixture struct {
	ID                 string          `json:"id"`
	Source             string          `json:"source"`
	Locale             string          `json:"locale"`
	Feature            string          `json:"feature,omitempty"`
	Options            json.RawMessage `json:"options"`
	Input              json.RawMessage `json:"input"`
	Expected           *string         `json:"expected,omitempty"`
	ExpectedOK         *bool           `json:"expectedOk,omitempty"`
	ExpectedLocales    []string        `json:"expectedLocales,omitempty"`
	ExpectedParts      []Part          `json:"expectedParts,omitempty"`
	ExpectedRange      *string         `json:"expectedRange,omitempty"`
	ExpectedRangeParts []RangePart     `json:"expectedRangeParts,omitempty"`
	ExpectedComparison *int            `json:"expectedComparison,omitempty"`
	ExpectedResolved   json.RawMessage `json:"expectedResolvedOptions,omitempty"`
	ExpectedSegments   []SegmentRecord `json:"expectedSegments,omitempty"`
	ErrorCode          string          `json:"errorCode,omitempty"`
}

func LoadFixtures

func LoadFixtures(root string) ([]Fixture, error)

func (Fixture) IsSupportedLocalesOf added in v0.2.9

func (f Fixture) IsSupportedLocalesOf() bool

IsSupportedLocalesOf reports whether the fixture exercises supportedLocalesOf.

func (Fixture) RequiredExpected added in v0.2.9

func (f Fixture) RequiredExpected(t testing.TB) string

RequiredExpected returns the fixture's expected string output.

type Part

type Part struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Unit  string `json:"unit,omitempty"`
}

type RangePart

type RangePart struct {
	Type   string `json:"type"`
	Value  string `json:"value"`
	Source string `json:"source"`
}

type SegmentRecord

type SegmentRecord struct {
	Segment       string `json:"segment"`
	CodeUnitIndex int    `json:"codeUnitIndex"`
	ByteIndex     *int   `json:"byteIndex,omitempty"`
	IsWordLike    *bool  `json:"isWordLike,omitempty"`
}

Jump to

Keyboard shortcuts

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