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 ¶
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 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"`
}
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 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.
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 ¶
LoadTestSet reads one test-set file named relative to the suite root.