Skip to content

Commit

Permalink
check: adding test for issue #280
Browse files Browse the repository at this point in the history
  • Loading branch information
drmohundro committed Aug 5, 2024
1 parent 7226ebc commit 4548ac8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Tests/SWXMLHashTests/XMLParsingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class XMLParsingTests: XCTestCase {
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<foo />
<description>After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society.</description>
</book>
</catalog>
Expand Down Expand Up @@ -85,6 +86,20 @@ class XMLParsingTests: XCTestCase {
func testShouldBeAbleToParseElementGroups() {
XCTAssertEqual(xml!["root"]["catalog"]["book"][1]["author"].element?.text, "Ralls, Kim")
}

Check failure on line 89 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 testForBugReported() {
let testXml = """
<event><detail><archive /></detail></event>
"""

Check failure on line 94 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)
let parser = XMLHash.parse(testXml)

Check failure on line 96 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)
XCTAssertNotNil(parser["event"]["detail"]["archive"].element)
XCTAssertNil(parser["event"]["detail"]["notThere"].element)

// XCTAssertNotNil(xml!["root"]["catalog"]["book"][2]["foo"].element)
// XCTAssertNil(xml!["root"]["catalog"]["book"][1]["foo"].element)
}

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

0 comments on commit 4548ac8

Please sign in to comment.