diff --git a/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift b/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift index f684d87..6e028fe 100644 --- a/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift +++ b/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift @@ -35,28 +35,23 @@ struct LazyWhiteSpaceParsingTests { init() { // Put setup code here. This method is called before the invocation of each test method in the class. -// #if SWIFT_PACKAGE -// let path = URL(fileURLWithPath: #file).deletingLastPathComponent().appendingPathComponent("test.xml").path -// #else -// let bundle = Bundle(for: WhiteSpaceParsingTests.self) -// let path = bundle.path(forResource: "test", ofType: "xml")! -// #endif - - let path = URL(fileURLWithPath: #file).deletingLastPathComponent().appendingPathComponent("test.xml").path - +#if SWIFT_PACKAGE + let path = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent("test.xml").path +#else + let bundle = Bundle(for: WhiteSpaceParsingTests.self) + let path = bundle.path(forResource: "test", ofType: "xml")! +#endif // swiftlint:disable:next force_try let data = try! Data(contentsOf: URL(fileURLWithPath: path)) xml = XMLHash.lazy(data) } // issue #6 - @Test - func shouldBeAbleToPullTextBetweenElementsWithoutWhitespace() { + @Test func shouldBeAbleToPullTextBetweenElementsWithoutWhitespace() { #expect(xml!["niotemplate"]["section"][0]["constraint"][1].element?.text == "H:|-15-[title]-15-|") } - @Test - func shouldBeAbleToCorrectlyParseCDATASectionsWithWhitespace() { + @Test func shouldBeAbleToCorrectlyParseCDATASectionsWithWhitespace() { #expect(xml!["niotemplate"]["other"].element?.text == "\n \n this\n has\n white\n space\n \n ") } } diff --git a/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift b/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift index 0a9f3bb..1bc7aff 100644 --- a/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift +++ b/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift @@ -35,7 +35,7 @@ struct WhiteSpaceParsingTests { init() { // Put setup code here. This method is called before the invocation of each test method in the class. #if SWIFT_PACKAGE - let path = URL(fileURLWithPath: #file).deletingLastPathComponent().appendingPathComponent("test.xml").path + let path = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent("test.xml").path #else let bundle = Bundle(for: WhiteSpaceParsingTests.self) let path = bundle.path(forResource: "test", ofType: "xml")!