import Testing
@testable import PureXML
/// An `xsi:type` may not name an abstract type: an abstract type cannot be the
/// type of an instance element (cvc-elt.4.3.2), so it is invalid as a substitution
/// even when the declared type would otherwise admit it. A concrete derived type
/// is accepted.
@Suite("abstract xsi:type")
struct SchemaAbstractXsiTypeTests {
private func schema() throws -> PureXML.Schema.Document {
try PureXML.Schema.Document("""
""")
}
private func doc(_ type: String) -> String {
#""#
}
@Test("an abstract xsi:type is rejected")
func test_abstractRejected() throws {
#expect(try !schema().validate(doc("Virtual")).isEmpty)
}
@Test("a concrete xsi:type is accepted")
func test_concreteAccepted() throws {
#expect(try schema().validate(doc("Real")).isEmpty)
}
}