Repository navigation
test(xml): the W3C XML conformance suite never ran against parsec-xml - #199
Open
jamesconwaydev wants to merge 2 commits into
Open
jamesconwaydev wants to merge 2 commits into
jamesconwaydev wants to merge 2 commits into
Conversation
crates/parsec-xml/scripts/fetch-xmlconf.sh downloads the suite's last release, pinned by address and SHA-256, and tests/xmlconf.rs runs all 2,585 cases as a processor that doesn't validate: valid and invalid documents parse, not-wf ones are errors, canonical output matches, and each parsed document round-trips through the serializer. 1,915 pass, none fail, and the 670 skipped each have a reason in the summary. CI's test and coverage jobs fetch the suite first; locally, cargo test skips it with a note when it isn't there.
This was referenced Nov 21, 2026
Brings the branch onto its new base after the pull request below it merged.
This branch has not been deployed
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.
Fixes #170.
Stacked on #198.
Problem.
parsec-xmlhad only its own tests. Nothing showed it handled the 2,585 cases of the W3C XML Conformance Test Suite, which is where XML parsers prove they reject what they must and accept what they must, and CI's summary had no XML row.Change.
crates/parsec-xml/scripts/fetch-xmlconf.shdownloads the suite's last release,xmlts20130923.tar.gzfromhttps://www.w3.org/XML/Test/, checks its SHA-256 (9b61db9f…fc1f) and unpacks it intotests/xmlconf, withCOMMITnaming the release. The suite has no git home to pin as a submodule, so the address and hash are the pin. Its files stay out of the repository and the package.tests/xmlconf.rsruns every case as a processor that doesn't validate:validandinvaliddocuments must parse,not-wfones must be errors, and a valid document with canonical output must produce exactly that output (James Clark's canonical form, and the second form with notations). Every document that parses is also written out withto_xmland must parse back to the same thing.EntityRefnodes, and the driver reads each part itself.$CONFORMANCE_DIR/xmlconf.jsonfor the CI summary. The test and coverage jobs fetch the suite first. Without it, a localcargo testskips the suite and says so; under CI it fails instead.Counts. 1,915 pass (223 matching their canonical output byte for byte), 0 fail, 670 skipped, each for its reason:
EDITION="1 2 3 4").errorcases, which the spec lets a processor report or not.not-wfcases whose fault is in an external entity or external DTD, which Parsec never reads. I checked a sample by hand:not-wf/ext-sa/*,not-wf/not-sa/*, oasisp09fail1andp30fail1, ibmP62–P79. Each puts the error in a.dtdor.entfile.One valid case,
ibm-valid-P29-ibm29v01.xml, parses and round-trips but isn't compared with its canonical output: that output puts a processing instruction from the internal subset before the<!DOCTYPE>, which no canonical form does. It's listed inBAD_OUTPUTwith that reason.Tests. The suite is the test. To check it can fail, I removed the
--check from comments and the space collapsing of tokenized attributes: 6 cases failed. Running it found two driver bugs, both fixed here: cases with noENTITIESattribute were taken as using external entities, andhst-lhs-007and-008(a declaration that contradicts the BOM) then showed the parser accepted them, which #198 fixes withencoding-mismatch.cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspacewithCONFORMANCE_DIRset,cargo deny checkandscripts/check-headers.shpass locally.