✅ test(xslt): validate XSLT 1.0 against libxslt REC suite#590
Merged
Conversation
591b41f to
57f0bd2
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
Add a conformance harness that runs turbohtml's XSLT 1.0 processor over libxslt's own XSLT 1.0 Recommendation corpus -- the REC and REC2 stylesheet/source/expected-output triples the reference implementation ships -- vendored as the pinned tests/conformance/libxslt submodule. Of the 79 cases, 56 pass byte-equal (whitespace normalized per output method); the other 23 use features turbohtml does not model and are xfail with the spec section each needs. The file is coverage-omitted like the differential suites so a missing submodule never drops the gate. The oracle surfaced four conformance bugs, all fixed: - A literal result element now copies its in-scope stylesheet namespace declarations to the output (section 7.1.1), de-duplicated against the output ancestors and filtered by exclude-result-prefixes, and XSLT directive attributes (xsl:*) are stripped rather than emitted. - xsl:number honors the separators around a format token (format="1. " -> "1. ", "(1)" -> "(1)"), and a value with no alphabetic/roman form (zero, negative, or a roman numeral past 4999) falls back to decimal instead of emitting nothing or an unbounded run. - A processing instruction serializes with the ?> terminator under the xml output method. validates tox-dev#537
5dd66d6 to
59c51d8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The XSLT 1.0 processor from #537 shipped with green coverage, but coverage proves the code runs, not that it matches the spec. This validates
turbohtml.transformagainst an authoritative external oracle: libxslt's own XSLT 1.0 Recommendation corpus, theRECandREC2stylesheet/source/expected-output triples the reference implementation behindlxml.etree.XSLTships. It vendors that corpus as the pinnedtests/conformance/libxsltshallow submodule and runs turbohtml over every triple, asserting byte-equal output with whitespace normalized per output method.Of the 79 cases, 56 pass exactly. The remaining 23 exercise features turbohtml does not model, so each is
xfailtagged with the spec section it needs: whitespace stripping (xsl:strip-space),xsl:namespace-alias, attribute sets, multi-levelxsl:number,cdata-section-elements, extension elements, and the html method's meta injection. 📋 The corpus is a git submodule, not a runtime library, so an absent checkout is a setup error: the module raises at import telling you to rungit submodule update --init, and the dedicated conformance CI job always checks it out.The oracle surfaced four conformance bugs, all fixed here. A literal result element now copies its in-scope stylesheet namespace declarations to the output per section 7.1.1, de-duplicated against the ancestors already in scope and filtered by
exclude-result-prefixes, so a prefixed or default-namespaced result element stays well-formed instead of losing its declaration;xsl:*directive attributes on a literal result element are stripped rather than emitted.xsl:numberhonors the separators around a format token, soformat="1. "yields1.andformat="(1)"yields(1), and a value with no alphabetic or roman form falls back to decimal 🔢. A roman numeral past 4999 previously produced an unbounded run ofM, a memory-exhaustion hazard, and zero or a negative produced empty output. A processing instruction now serializes with the?>terminator under thexmloutput method.Line and branch C coverage stays at 100% on the changed
xslt.canddocument.c. Three existing unit tests that had pinned the pre-fix behavior are corrected to the libxslt-confirmed output.validates #537