Skip to content

Commit

Permalink
fix: use #filePath instead of #file
Browse files Browse the repository at this point in the history
  • Loading branch information
drmohundro committed Aug 16, 2024
1 parent 4a8eda9 commit ca1b404
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 8 additions & 13 deletions Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Check failure on line 50 in Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift

View workflow job for this annotation

GitHub Actions / Docker Lint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)

Check failure on line 50 in Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift

View workflow job for this annotation

GitHub Actions / Docker Lint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)
#expect(xml!["niotemplate"]["section"][0]["constraint"][1].element?.text == "H:|-15-[title]-15-|")
}

@Test
func shouldBeAbleToCorrectlyParseCDATASectionsWithWhitespace() {
@Test func shouldBeAbleToCorrectlyParseCDATASectionsWithWhitespace() {

Check failure on line 54 in Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift

View workflow job for this annotation

GitHub Actions / Docker Lint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)

Check failure on line 54 in Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift

View workflow job for this annotation

GitHub Actions / Docker Lint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)
#expect(xml!["niotemplate"]["other"].element?.text == "\n \n this\n has\n white\n space\n \n ")
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")!
Expand Down

0 comments on commit ca1b404

Please sign in to comment.