From 4548ac8fda332bd8a0f24e2f28513c6ba622941b Mon Sep 17 00:00:00 2001 From: David Mohundro Date: Sun, 4 Aug 2024 19:28:06 -0500 Subject: [PATCH] check: adding test for issue #280 --- Tests/SWXMLHashTests/XMLParsingTests.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tests/SWXMLHashTests/XMLParsingTests.swift b/Tests/SWXMLHashTests/XMLParsingTests.swift index 0a16172..c000ca1 100644 --- a/Tests/SWXMLHashTests/XMLParsingTests.swift +++ b/Tests/SWXMLHashTests/XMLParsingTests.swift @@ -56,6 +56,7 @@ class XMLParsingTests: XCTestCase { Fantasy 5.95 2000-11-17 + After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society. @@ -85,6 +86,20 @@ class XMLParsingTests: XCTestCase { func testShouldBeAbleToParseElementGroups() { XCTAssertEqual(xml!["root"]["catalog"]["book"][1]["author"].element?.text, "Ralls, Kim") } + + func testForBugReported() { + let testXml = """ + + """ + + let parser = XMLHash.parse(testXml) + + 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")