test262

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package test262 provides a runner for the official ECMAScript conformance suite (Test262), located under reference/test262. It parses each test's YAML frontmatter, assembles the required harness includes, executes the test with the engine under a timeout, and classifies the outcome against the test's declared expectation (positive or negative).

It is deliberately conservative: tests using features gojs does not implement (modules, raw/generated forms, and a configurable feature denylist) are reported as skipped rather than failed, so the pass rate reflects real conformance of implemented features. Async tests (flags: [async]) are run: the runner supplies $DONE and inspects the reported completion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Includes   []string
	Flags      map[string]bool
	Features   []string
	NegType    string // expected error constructor name (negative tests)
	NegPhase   string // "parse", "resolution", or "runtime"
	IsNegative bool
}

Meta holds the parsed subset of a test's frontmatter that the runner needs.

func ParseMeta

func ParseMeta(src string) Meta

ParseMeta extracts the frontmatter metadata from a test's source.

type Outcome

type Outcome int

Outcome classifies a single test run.

const (
	Pass Outcome = iota
	Fail         // engine behavior disagreed with the test's expectation
	Skip         // test needs a feature/flag gojs does not support
)

type Result

type Result struct {
	Path    string
	Mode    string // "strict" or "sloppy"
	Outcome Outcome
	Reason  string
}

Result is the outcome of running one test file (one mode).

func Run

func Run(path string) []Result

Run executes a single test file, returning one Result per applicable mode (strict/sloppy). It never panics; failures are captured as Fail outcomes.

Jump to

Keyboard shortcuts

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