diff --git a/Gzip.xcodeproj/project.pbxproj b/Gzip.xcodeproj/project.pbxproj index 2680342..d135bcc 100644 --- a/Gzip.xcodeproj/project.pbxproj +++ b/Gzip.xcodeproj/project.pbxproj @@ -225,7 +225,6 @@ isa = PBXGroup; children = ( 2A7DC79E1FB6AFC900539D90 /* GzipTests */, - 2A8219C61D65AFB300D65063 /* test.txt.gz */, ); path = Tests; sourceTree = ""; @@ -234,6 +233,7 @@ isa = PBXGroup; children = ( 2A58A75C1B00F414005FBBC2 /* GzipTests.swift */, + 2A8219C61D65AFB300D65063 /* test.txt.gz */, ); path = GzipTests; sourceTree = ""; diff --git a/Package.swift b/Package.swift index 39c06df..87d366b 100644 --- a/Package.swift +++ b/Package.swift @@ -10,7 +10,11 @@ let package = Package( targets: [ .target(name: "Gzip", dependencies: ["system-zlib"]), .target(name: "system-zlib"), - .testTarget(name: "GzipTests", dependencies: ["Gzip"]), + .testTarget( + name: "GzipTests", + dependencies: ["Gzip"], + resources: [.copy("./test.txt.gz")] + ), ], swiftLanguageVersions: [ .v5, diff --git a/Tests/GzipTests/GzipTests.swift b/Tests/GzipTests/GzipTests.swift index c7b0dab..47c78a8 100644 --- a/Tests/GzipTests/GzipTests.swift +++ b/Tests/GzipTests/GzipTests.swift @@ -127,10 +127,7 @@ private extension XCTestCase { func bundleFile(name: String) -> URL { #if SWIFT_PACKAGE - return URL(fileURLWithPath: #file) - .deletingLastPathComponent() - .deletingLastPathComponent() - .appendingPathComponent(name) + return Bundle.module.url(forResource: name, withExtension: nil)! #else return Bundle(for: type(of: self)).url(forResource: name, withExtension: nil)! #endif diff --git a/Tests/test.txt.gz b/Tests/GzipTests/test.txt.gz similarity index 100% rename from Tests/test.txt.gz rename to Tests/GzipTests/test.txt.gz