Skip to content

Commit aa0670b

Browse files
authored
Add regression test for #5728 (#5991)
1 parent c49480c commit aa0670b

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// swift-tools-version:5.8
2+
import PackageDescription
3+
4+
// This package acts as a regression test for the FoundationlessPackages to
5+
// assert that Swift targets with resources are not affected by using
6+
// `@_implementationOnly import Foundation` in the generated resource accessor.
7+
let package = Package(
8+
name: "UtilsWithFoundationPkg",
9+
targets: [
10+
.target(
11+
name: "UtilsWithFoundationPkg",
12+
resources: [
13+
.copy("foo.txt"),
14+
]
15+
)
16+
]
17+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Foundation
2+
3+
@frozen
4+
public enum FooUtils { }
5+
6+
extension FooUtils {
7+
public static let foo: String = "Hello, World!"
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo

Tests/FunctionalTests/ResourcesTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ class ResourcesTests: XCTestCase {
116116
}
117117
}
118118

119+
func testSwiftResourceAccessorDoesNotCauseInconsistentImportWarning() throws {
120+
try fixture(name: "Resources/FoundationlessClient/UtilsWithFoundationPkg") { fixturePath in
121+
XCTAssertBuilds(
122+
fixturePath,
123+
Xswiftc: ["-warnings-as-errors"]
124+
)
125+
}
126+
}
127+
119128
func testResourceBundleInClangPackageWhenRunningSwiftTest() throws {
120129
#if !os(macOS)
121130
// Running swift-test fixtures on linux is not yet possible.

0 commit comments

Comments
 (0)