Adopt resource bundles for the SPM test target.
This commit is contained in:
parent
e99ced22d0
commit
b2b5af0d98
|
@ -225,7 +225,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
2A7DC79E1FB6AFC900539D90 /* GzipTests */,
|
||||
2A8219C61D65AFB300D65063 /* test.txt.gz */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
|
@ -234,6 +233,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
2A58A75C1B00F414005FBBC2 /* GzipTests.swift */,
|
||||
2A8219C61D65AFB300D65063 /* test.txt.gz */,
|
||||
);
|
||||
path = GzipTests;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:5.0
|
||||
// swift-tools-version:5.3
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue