Root Swift package mirroring PureYAML's structure, rules, and verification gates. Includes the XML node model (Node, Element, Attribute, QualifiedName), a working emitter (Serializer) with escaping and pretty/compact options, and structural validation. The parser surface is stable; parse() raises notImplemented until the scanner lands, pinned by a test. - dependency-free, namespaced under PureXML - portability and style gates carried over (style, namespacing, forbidden patterns, swiftformat, swiftlint, linux, wasm, windows CI) - 11 tests passing
30 lines
995 B
Swift
30 lines
995 B
Swift
@testable import PureXML
|
|
import Testing
|
|
|
|
@Suite("Parsing")
|
|
struct ParsingTests {
|
|
@Test("Empty input reports an empty document")
|
|
func test_emptyInputThrows() {
|
|
#expect(throws: PureXML.Parsing.ParseError.emptyDocument) {
|
|
try PureXML.parse("")
|
|
}
|
|
}
|
|
|
|
/// The tokenizing parser is not implemented yet. This test pins the current
|
|
/// contract so the gap is explicit rather than a silent partial parse.
|
|
@Test("Non-empty input reports the parser is not implemented yet")
|
|
func test_nonEmptyInputNotImplemented() {
|
|
do {
|
|
_ = try PureXML.parse("<root/>")
|
|
Issue.record("expected parse to throw notImplemented")
|
|
} catch let error as PureXML.Parsing.ParseError {
|
|
guard case .notImplemented = error else {
|
|
Issue.record("expected notImplemented, got \(error)")
|
|
return
|
|
}
|
|
} catch {
|
|
Issue.record("unexpected error: \(error)")
|
|
}
|
|
}
|
|
}
|