Skip to content

Tests: prefer XCTAssertEqual over XCTAssertTrue #5083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Tests/Foundation/TestXMLDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ class TestXMLDocument : LoopbackServerTest {
XCTAssert(element.name! == "D:propfind")
XCTAssert(element.rootDocument == nil)
if let namespace = element.namespaces?.first {
XCTAssert(namespace.prefix == "D")
XCTAssert(namespace.stringValue == "DAV:")
XCTAssertEqual(namespace.prefix, "D")
XCTAssertEqual(namespace.stringValue, "DAV:")
} else {
XCTFail("Namespace was not parsed correctly")
}

if let child = element.elements(forName: "D:prop").first {
XCTAssert(child.localName == "prop")
XCTAssert(child.prefix == "D")
XCTAssert(child.name == "D:prop")
XCTAssertEqual(child.localName, "prop")
XCTAssertEqual(child.prefix, "D")
XCTAssertEqual(child.name, "D:prop")
} else {
XCTFail("Child element was not parsed correctly!")
}
Expand Down Expand Up @@ -484,8 +484,8 @@ class TestXMLDocument : LoopbackServerTest {
let elementDecl = XMLDTDNode(kind: .elementDeclaration)
elementDecl.name = "MyElement"
elementDecl.stringValue = "(#PCDATA | array)*"
XCTAssert(elementDecl.stringValue == "(#PCDATA | array)*", elementDecl.stringValue ?? "nil string value")
XCTAssert(elementDecl.name == "MyElement")
XCTAssertEqual(elementDecl.stringValue, "(#PCDATA | array)*")
XCTAssertEqual(elementDecl.name, "MyElement")
}

func test_documentWithDTD() throws {
Expand Down Expand Up @@ -562,9 +562,9 @@ class TestXMLDocument : LoopbackServerTest {
XCTAssert(newNS.name == "F")

let root = doc.rootElement()!
XCTAssert(root.localName == "propfind")
XCTAssert(root.name == "D:propfind")
XCTAssert(root.prefix == "D")
XCTAssertEqual(root.localName, "propfind")
XCTAssertEqual(root.name, "D:propfind")
XCTAssertEqual(root.prefix, "D")
let node = doc.findFirstChild(named: "prop")
XCTAssert(node != nil, "failed to find existing node")
XCTAssert(node?.localName == "prop")
Expand Down