Skip to content

Commit

Permalink
feat: add initial parent test
Browse files Browse the repository at this point in the history
  • Loading branch information
drmohundro committed Nov 1, 2023
1 parent a3e0af6 commit 463a6f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tests/SWXMLHashTests/XMLParsingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class XMLParsingTests: XCTestCase {
func testShouldBeAbleToParseElementGroups() {
XCTAssertEqual(xml!["root"]["catalog"]["book"][1]["author"].element?.text, "Ralls, Kim")
}

Check failure on line 88 in Tests/SWXMLHashTests/XMLParsingTests.swift

View workflow job for this annotation

GitHub Actions / Docker Lint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)

Check failure on line 88 in Tests/SWXMLHashTests/XMLParsingTests.swift

View workflow job for this annotation

GitHub Actions / Docker Lint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
func testShouldBeAbleToGetParent() {
XCTAssertNotNil(xml!["root"]["catalog"]["book"][1]["author"].element?.parent)
XCTAssertEqual(xml!["root"]["catalog"]["book"][1]["author"].element?.parent?.name, "book")
XCTAssertEqual(xml!["root"]["catalog"]["book"][1]["author"].element?.parent?.attribute(by: "id")?.text, "bk102")
}

func testShouldBeAbleToParseElementGroupsByIndex() {
XCTAssertEqual(try xml!["root"]["catalog"]["book"].byIndex(1)["author"].element?.text, "Ralls, Kim")
Expand Down

0 comments on commit 463a6f9

Please sign in to comment.