Skip to content

Commit a12c7d1

Browse files
authored
Merge pull request #5083 from compnerd/equal
Tests: prefer `XCTAssertEqual` over `XCTAssertTrue`
2 parents c820f72 + 83062fa commit a12c7d1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Tests/Foundation/TestXMLDocument.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ class TestXMLDocument : LoopbackServerTest {
2727
XCTAssert(element.name! == "D:propfind")
2828
XCTAssert(element.rootDocument == nil)
2929
if let namespace = element.namespaces?.first {
30-
XCTAssert(namespace.prefix == "D")
31-
XCTAssert(namespace.stringValue == "DAV:")
30+
XCTAssertEqual(namespace.prefix, "D")
31+
XCTAssertEqual(namespace.stringValue, "DAV:")
3232
} else {
3333
XCTFail("Namespace was not parsed correctly")
3434
}
3535

3636
if let child = element.elements(forName: "D:prop").first {
37-
XCTAssert(child.localName == "prop")
38-
XCTAssert(child.prefix == "D")
39-
XCTAssert(child.name == "D:prop")
37+
XCTAssertEqual(child.localName, "prop")
38+
XCTAssertEqual(child.prefix, "D")
39+
XCTAssertEqual(child.name, "D:prop")
4040
} else {
4141
XCTFail("Child element was not parsed correctly!")
4242
}
@@ -484,8 +484,8 @@ class TestXMLDocument : LoopbackServerTest {
484484
let elementDecl = XMLDTDNode(kind: .elementDeclaration)
485485
elementDecl.name = "MyElement"
486486
elementDecl.stringValue = "(#PCDATA | array)*"
487-
XCTAssert(elementDecl.stringValue == "(#PCDATA | array)*", elementDecl.stringValue ?? "nil string value")
488-
XCTAssert(elementDecl.name == "MyElement")
487+
XCTAssertEqual(elementDecl.stringValue, "(#PCDATA | array)*")
488+
XCTAssertEqual(elementDecl.name, "MyElement")
489489
}
490490

491491
func test_documentWithDTD() throws {
@@ -562,9 +562,9 @@ class TestXMLDocument : LoopbackServerTest {
562562
XCTAssert(newNS.name == "F")
563563

564564
let root = doc.rootElement()!
565-
XCTAssert(root.localName == "propfind")
566-
XCTAssert(root.name == "D:propfind")
567-
XCTAssert(root.prefix == "D")
565+
XCTAssertEqual(root.localName, "propfind")
566+
XCTAssertEqual(root.name, "D:propfind")
567+
XCTAssertEqual(root.prefix, "D")
568568
let node = doc.findFirstChild(named: "prop")
569569
XCTAssert(node != nil, "failed to find existing node")
570570
XCTAssert(node?.localName == "prop")

0 commit comments

Comments
 (0)