@testable import PureXML import Testing @Suite("RELAX NG combine on define") struct RelaxNGCombineTests { private let rngNamespace = "xmlns=\"http://relaxng.org/ns/structure/1.0\"" private func valid(_ rng: String, _ xml: String) throws -> Bool { try PureXML.Schema.RelaxNG(rng).validate(xml) } @Test("combine=choice merges two definitions of the same name as a choice") func test_combineChoice() throws { let rng = """ """ // Both alternatives validate against the merged choice. #expect(try valid(rng, "")) #expect(try valid(rng, "")) #expect(try !valid(rng, "")) } @Test("combine=interleave merges two definitions as an interleave") func test_combineInterleave() throws { let rng = """ """ // Interleave admits the two children in either order. #expect(try valid(rng, "")) #expect(try valid(rng, "")) // Both are required by the interleave, so one alone fails. #expect(try !valid(rng, "")) } @Test("A plain redefinition without combine still replaces") func test_plainRedefinitionReplaces() throws { let rng = """ """ #expect(try !valid(rng, "")) #expect(try valid(rng, "")) } }