The ported engine wins every conflict: main's post-fork patches to the hand-rolled Scanner and TokenEventParser land on deleted files and are dropped; their behaviors are carried by the port and guarded by the whole-suite conformance gate (402/402 passing). Merge adaptations, all gates green (style, namespacing, forbidden patterns, changelog, roadmap, swiftformat, swiftlint strict, build, full test suite, whole-suite conformance sweep): - PureYAMLJSON representability rules move onto the Check algebra, replacing the retired legacy Rule type. - The permissive tag-handle pre-pass is removed; the port rejects an undefined handle at parse time (suite case QLJ7) and the validation report carries it as a parse diagnostic. - EventStreamComposer's nested types split one-per-file per the namespacing gate. - Tests pinned to old-engine behavior were re-verified against the reference and updated: libyaml rejects an explicit-key continuation ending at a value colon, and suite case QB6E requires rejecting a quoted continuation at column 0. - CHANGELOG unreleased entries from both lines are preserved in two groups with a provenance note. Closes #1, closes #3
24 lines
1.0 KiB
Swift
24 lines
1.0 KiB
Swift
@testable import PureYAML
|
|
import Testing
|
|
|
|
@Suite("Undefined tag handles are parse errors")
|
|
struct TagHandleDiagnosticTests {
|
|
@Test("An undeclared named tag handle is rejected at parse time")
|
|
func test_undeclaredHandleRejected() {
|
|
// The ported engine is strict: a tag shorthand whose handle was never declared by a
|
|
// `%TAG` directive fails the parse, so the old permissive-parse scanner pre-pass
|
|
// (`Scanner.tagHandleIssues`) has no successor and no gap to fill.
|
|
#expect(throws: (any Error).self) {
|
|
_ = try PureYAML.parse("key: !foo!bar\n")
|
|
}
|
|
}
|
|
|
|
@Test("The validation report carries the undefined handle as a parse diagnostic")
|
|
func test_reportCarriesUndefinedHandle() {
|
|
let report = PureYAML.validationReport("key: !foo!bar\n")
|
|
let parseErrors = report.diagnostics.filter { $0.kind == .parse && $0.severity == .error }
|
|
#expect(parseErrors.count == 1)
|
|
#expect(parseErrors.first?.reason.contains("undefined tag handle") == true)
|
|
}
|
|
}
|