Embed the wire-shape parity corpus in Swift - #25
Open
coenttb wants to merge 1 commit into
Open
Conversation
Replaces the 9 `__Corpus__/*.txt` fixtures with one generated `Corpus.swift` holding the same documents as raw-string literals keyed by fixture basename. Each embedded document is byte-identical to the file it replaces, verified programmatically against the blobs at main. `assertParity` and `recordNonRoundTrips` compare against the embedded document instead of reading and record-when-absent writing a path under `__Corpus__`, so the target no longer excludes that directory. Corpora are still looked up by the same names and compared the same way; a missing document is now reported rather than silently recorded.
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.
Converts the last non-Swift files under
Tests/to generated Swift, per swift-institute/.github#600.The 9
Tests/Authentication Router Parity Tests/__Corpus__/*.txtfixtures become one generatedCorpus.swift: anenum Corpuswhosedocumentsdictionary is keyed by fixture basename and exposed throughstatic subscript(_:) -> String?. Documents are extended raw-string literals, so nothing is escaped, and the trailing newline is appended explicitly because Swift drops the final newline of a multiline literal.assertParityandrecordNonRoundTripsnow compare against the embedded document instead of resolving a path under__Corpus__relative to#filePath, soexclude: ["__Corpus__"]is dropped from the manifest. The corpora are looked up by the same names and compared the same way.One deliberate behaviour change:
Parity.fixture(_:at:)recorded a fixture when the file was absent. There is no file to record into now, so a missing document is reported as an issue instead. Re-recording becomes a matter of regenerating the corpus, which is the point of embedding it — the expected bytes are reviewable in the diff rather than appearing silently on a first run.Gate: each embedded document was decoded back out of the generated Swift by an independent parser and compared byte-for-byte against
git show origin/main:<path>— 9/9 identical. The generated file type-checks clean under Swift 6.Note on the base:
maindoes not build locally here — resolution pulls aswift-favicon/WHATWG_HTML_FormAttributesambiguity in from a dependency checkout, untouched by this change — so this PR's own CI run is the evidence.