qt3

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package qt3 runs the W3C QT3 (FOTS) test suite against this engine.

The suite is not vendored: it is ~78MB and belongs to the W3C. Point GOXSLT_QT3 at a checkout of https://github.com/w3c/qt3tests and the tests in this package run; without it they skip. That keeps `go test ./...` fast and dependency-free for everyone else while making the conformance run reproducible for anyone who wants it.

Index

Constants

View Source
const CaseTimeout = 10 * time.Second

CaseTimeout bounds a single test case. It is generous: the point is to contain a non-terminating expression, not to measure performance.

Variables

View Source
var SuiteClock = time.Date(2024, 1, 15, 9, 30, 0, 0, time.FixedZone("", -5*3600))

SuiteClock is the fixed value fn:current-dateTime returns during a run. It carries a non-UTC offset because a UTC-only clock would let a timezone bug pass unnoticed.

Functions

func SuiteRoot

func SuiteRoot() string

SuiteRoot returns the checkout directory, or "" when the suite is absent.

Types

type Assertion

type Assertion struct {
	// Kind is the element name: "assert-eq", "all-of", "error", and so on.
	Kind string
	// Value is the character data, which for most kinds is the expected value.
	Value string
	// Code is the @code of an <error>, and @type of an assert-type.
	Code string
	// File is the @file of an assert-xml whose expected value is held in a
	// separate document rather than inline. Without it the comparison ran
	// against an empty string, which reported every such case as a mismatch
	// against "".
	File string
	// Children are the operands of all-of / any-of / not.
	Children []Assertion
}

Assertion is one node of the result tree.

func ParseAssert

func ParseAssert(raw []byte) (Assertion, error)

ParseAssert parses the raw result XML into an assertion tree.

type Catalog

type Catalog struct {
	XMLName      xml.Name      `xml:"catalog"`
	TestSets     []TestSetRef  `xml:"test-set"`
	Environments []Environment `xml:"environment"`
}

Catalog is the top-level catalog.xml.

func LoadCatalog

func LoadCatalog(root string) (*Catalog, error)

LoadCatalog reads catalog.xml from the suite root.

type Collation

type Collation struct {
	URI     string `xml:"uri,attr"`
	Default string `xml:"default,attr"`
}

type Collection

type Collection struct {
	URI     string   `xml:"uri,attr"`
	Sources []Source `xml:"source"`
}

Collection is a named set of documents an environment supplies to fn:collection.

The sources carry the same role/file/uri attributes as a context source, but role is unused: membership in the collection is the point, not the name it is bound to.

type Dependency

type Dependency struct {
	Type      string `xml:"type,attr"`
	Value     string `xml:"value,attr"`
	Satisfied string `xml:"satisfied,attr"`
}

type Environment

type Environment struct {
	Name       string      `xml:"name,attr"`
	Ref        string      `xml:"ref,attr"`
	Sources    []Source    `xml:"source"`
	Params     []Param     `xml:"param"`
	Namespaces []Namespace `xml:"namespace"`
	Schemas    []Schema    `xml:"schema"`
	// Collations and a declared default collation appear on a few
	// environments; a test needing a non-codepoint one is unsupported here.
	Collations []Collation `xml:"collation"`
	// StaticBaseURI supplies the base URI of the expression itself, which is
	// what fn:static-base-uri returns and what fn:resolve-uri resolves
	// against.
	StaticBaseURI []StaticBaseURI `xml:"static-base-uri"`
	// Collections are the document sets fn:collection returns.
	Collections []Collection `xml:"collection"`
}

type Namespace

type Namespace struct {
	Prefix string `xml:"prefix,attr"`
	URI    string `xml:"uri,attr"`
}

type Outcome

type Outcome int

Outcome is what happened to one test case.

const (
	Pass Outcome = iota
	Fail
	// Skip covers a test this engine is not in scope for — an XQuery-only
	// construct, a 3.0/3.1 feature, or a schema-aware environment. A skip is
	// not a pass and is reported separately, because counting them as passes
	// is how a conformance number becomes meaningless.
	Skip
)

type Param

type Param struct {
	Name   string `xml:"name,attr"`
	Select string `xml:"select,attr"`
	As     string `xml:"as,attr"`
}

type Report

type Report struct {
	Set, Case string
	Outcome   Outcome
	Reason    string
	// Expr is the expression the case evaluated. A failure line naming only
	// the case means opening the catalog to find out what it ran; carrying it
	// here makes the report reproducible by hand.
	Expr string
}

Report is the result of one case.

type Result

type Result struct {
	Raw []byte `xml:",innerxml"`
}

Result is the assertion tree, kept as raw XML and parsed by ParseAssert.

The nesting is arbitrary — all-of and any-of contain further assertions to any depth — and struct tags cannot express that, so it is walked with the token stream instead.

type Runner

type Runner struct {
	Root string
	// contains filtered or unexported fields
}

Runner executes cases from a suite checkout.

func NewRunner

func NewRunner(root string, cat *Catalog) *Runner

func (*Runner) Run

func (r *Runner) Run(ts *TestSet, tc *TestCase) (rep Report)

Run executes one case.

A panic in the engine is recorded as a failure rather than allowed to abort the run: a crash is the most severe kind of conformance failure, and losing the other 28,000 results to it would hide everything behind the first one.

type Schema

type Schema struct {
	URI  string `xml:"uri,attr"`
	File string `xml:"file,attr"`
}

type Source

type Source struct {
	Role string `xml:"role,attr"`
	File string `xml:"file,attr"`
	URI  string `xml:"uri,attr"`
}

type StaticBaseURI

type StaticBaseURI struct {
	URI string `xml:"uri,attr"`
}

type TestCase

type TestCase struct {
	Name         string        `xml:"name,attr"`
	Description  string        `xml:"description"`
	Environments []Environment `xml:"environment"`
	Dependencies []Dependency  `xml:"dependency"`
	Test         string        `xml:"test"`
	Modules      []struct {
		URI  string `xml:"uri,attr"`
		File string `xml:"file,attr"`
	} `xml:"module"`
	Result Result `xml:"result"`
}

type TestSet

type TestSet struct {
	XMLName      xml.Name      `xml:"test-set"`
	Name         string        `xml:"name,attr"`
	Environments []Environment `xml:"environment"`
	Dependencies []Dependency  `xml:"dependency"`
	Cases        []TestCase    `xml:"test-case"`

	// Dir is the test-set file's directory, relative to the suite root.
	//
	// Source paths are relative to the test-set file, not to the root:
	// fn/collection.xml names "../docs/bib.xml". Joining those against the
	// root walks above it and the file is not found, so the directory has to
	// travel with the parsed set.
	Dir string `xml:"-"`
}

TestSet is one test-set file, e.g. fn/abs.xml.

func LoadTestSet

func LoadTestSet(root, file string) (*TestSet, error)

LoadTestSet reads one test-set file named relative to the suite root.

type TestSetRef

type TestSetRef struct {
	Name string `xml:"name,attr"`
	File string `xml:"file,attr"`
}

Jump to

Keyboard shortcuts

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