Skip to content

Commit a32b79f

Browse files
committed
XMLDocument: Add a test for SR-10776.
1 parent 0a04b94 commit a32b79f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

TestFoundation/TestXMLDocument.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TestXMLDocument : LoopbackServerTest {
3939
("test_optionPreserveAll", test_optionPreserveAll),
4040
("test_rootElementRetainsDocument", test_rootElementRetainsDocument),
4141
("test_nodeKinds", test_nodeKinds),
42+
("test_sr10776_documentName", test_sr10776_documentName),
4243
]
4344
}
4445

@@ -551,7 +552,7 @@ class TestXMLDocument : LoopbackServerTest {
551552

552553
XCTAssertEqual(try? test(), "plans")
553554
}
554-
555+
555556
func test_nodeKinds() {
556557
XCTAssertEqual(XMLDocument(rootElement: nil).kind, .document)
557558
XCTAssertEqual(XMLElement(name: "prefix:localName").kind, .element)
@@ -565,6 +566,13 @@ class TestXMLDocument : LoopbackServerTest {
565566
XCTAssertEqual(XMLDTDNode(xmlString: "<!ATTLIST A B CDATA #IMPLIED>")?.kind, .attributeDeclaration)
566567
XCTAssertEqual(XMLDTDNode(xmlString: "<!ELEMENT E EMPTY>")?.kind, .elementDeclaration)
567568
XCTAssertEqual(XMLDTDNode(xmlString: #"<!NOTATION f SYSTEM "F">"#)?.kind, .notationDeclaration)
569+
570+
func test_sr10776_documentName() {
571+
let doc = XMLDocument(rootElement: nil)
572+
XCTAssertNil(doc.name)
573+
574+
doc.name = "name"
575+
XCTAssertNil(doc.name) // `name` of XMLDocument is always nil.
568576
}
569577
}
570578

0 commit comments

Comments
 (0)