@testable import PureXML
import Testing
@Suite("XSLT xsl:output doctype-public / doctype-system")
struct XSLTDoctypeOutputTests {
private let xsl = "xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\""
private func transform(_ stylesheet: String, _ source: String) throws -> String {
try PureXML.XSLT.transform(stylesheet: stylesheet, source: source)
}
@Test("doctype-system emits a SYSTEM doctype before the root")
func test_systemOnly() throws {
let style = """
"""
#expect(try transform(style, "") == "\n")
}
@Test("doctype-public and doctype-system emit a PUBLIC doctype")
func test_publicAndSystem() throws {
let style = """
"""
let out = try transform(style, "")
#expect(out.hasPrefix("\n"))
#expect(out.contains(""))
}
@Test("Without doctype-system no doctype is emitted")
func test_none() throws {
let style = """
"""
#expect(try transform(style, "") == "")
}
}