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
- Variables
- func SuiteRoot() string
- type Assertion
- type Catalog
- type Collation
- type Collection
- type DecimalFormatDecl
- type Dependency
- type Environment
- type Namespace
- type Outcome
- type Param
- type Report
- type Resource
- type Result
- type Runner
- type Schema
- type Source
- type StaticBaseURI
- type TargetVersion
- type TestCase
- type TestSet
- type TestSetRef
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
LoadCatalog reads catalog.xml from the suite root.
type Collection ¶
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 DecimalFormatDecl ¶ added in v1.1.0
type DecimalFormatDecl struct {
// Name is the lexical QName the declaration carries. Its prefix may be
// declared on the decimal-format element itself, so the namespace it
// binds to is recovered from Attrs rather than from the environment.
Name string `xml:"name,attr"`
Attrs []xml.Attr `xml:",any,attr"`
DecimalSeparator string `xml:"decimal-separator,attr"`
GroupingSeparator string `xml:"grouping-separator,attr"`
Percent string `xml:"percent,attr"`
PerMille string `xml:"per-mille,attr"`
ZeroDigit string `xml:"zero-digit,attr"`
Digit string `xml:"digit,attr"`
PatternSeparator string `xml:"pattern-separator,attr"`
MinusSign string `xml:"minus-sign,attr"`
Infinity string `xml:"infinity,attr"`
NaN string `xml:"NaN,attr"`
ExponentSeparator string `xml:"exponent-separator,attr"`
}
DecimalFormatDecl is one <decimal-format> declaration. Every attribute is optional and defaults to the standard symbol, so each is a pointer-free string tested for emptiness rather than a value with its own default.
type Dependency ¶
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"`
// Resources are the non-XML files fn:unparsed-text reads, mapping the URI
// a case names to the file in the checkout that holds it.
Resources []Resource `xml:"resource"`
// DecimalFormats are the decimal formats fn:format-number reads. Only the
// unnamed (default) one is used by these cases.
DecimalFormats []DecimalFormatDecl `xml:"decimal-format"`
}
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 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 Resource ¶ added in v1.1.0
type Resource struct {
File string `xml:"file,attr"`
URI string `xml:"uri,attr"`
MediaType string `xml:"media-type,attr"`
Encoding string `xml:"encoding,attr"`
}
Resource is one <resource> declaration: a file in the checkout published under the URI a test case uses to reach it.
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
// Target is the language version the run is scoped to. The zero value is
// XPath20, so an existing caller that does not set it keeps the 2.0 run
// it had before.
Target TargetVersion
// contains filtered or unexported fields
}
Runner executes cases from a suite checkout.
type StaticBaseURI ¶
type StaticBaseURI struct {
URI string `xml:"uri,attr"`
}
type TargetVersion ¶ added in v1.1.0
type TargetVersion int
TargetVersion selects the language version the run is scoped to.
The suite is FOTS 3.1 and every case declares the versions it applies to, so which cases are in scope is a property of the run rather than of the engine. Scoping to 2.0 and to 3.0 are two measurements of the same suite, and both are reported: the 2.0 figure must not move as 3.0 is implemented, which is what makes it a regression check rather than just a headline.
const ( // XPath20 scopes the run to cases that apply to XPath 2.0. XPath20 TargetVersion = iota // XPath30 scopes the run to cases that apply to XPath 2.0 or 3.0. XPath30 // XPath31 scopes the run to cases that apply to 2.0, 3.0 or 3.1. XPath31 )
func (TargetVersion) String ¶ added in v1.1.0
func (v TargetVersion) String() string
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 ¶
LoadTestSet reads one test-set file named relative to the suite root.