PureXML/Tests/RelaxNGNameClassTests.swift
Mihaela Mihaljevic 83e6e27d12 style(format): adopt --importgrouping testable-bottom from canonical rules-swift
Group @testable imports at the bottom, per public/rules-swift's swiftformat. A
behavior-preserving import-ordering reformat across 252 files (mostly tests).
--trailingclosures was deliberately not adopted (cosmetic, and swiftformat flags
it as caution-worthy).
2026-06-18 20:33:07 +02:00

23 lines
771 B
Swift

import Testing
@testable import PureXML
@Suite("RELAX NG compact name-class subtraction")
struct RelaxNGNameClassTests {
private func valid(_ rnc: String, _ xml: String) throws -> Bool {
try PureXML.Schema.RelaxNG(compact: rnc).validate(xml)
}
@Test("* - name admits any element except the subtracted one")
func test_subtraction() throws {
let rnc = "element root { element * - skip { empty }* }"
#expect(try valid(rnc, "<root><a/><b/></root>"))
#expect(try !valid(rnc, "<root><skip/></root>"))
}
@Test("A plain wildcard still admits everything")
func test_plainWildcard() throws {
let rnc = "element root { element * { empty }* }"
#expect(try valid(rnc, "<root><skip/><a/></root>"))
}
}