Skip to content

Commit da23eab

Browse files
authored
Add additional tests for interpreterFlags (#8172)
Addresses #8138 (comment)
1 parent 11ebe9e commit da23eab

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Tests/WorkspaceTests/WorkspaceTests.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,36 @@ final class WorkspaceTests: XCTestCase {
228228

229229
XCTAssertMatch(try ws.interpreterFlags(for: packageManifest), [.equal("-package-description-version")])
230230
}
231+
232+
do {
233+
let ws = try createWorkspace(
234+
"""
235+
// swift-tools-version:3.0
236+
import PackageDescription
237+
"""
238+
)
239+
XCTAssertThrowsError(
240+
try ws.interpreterFlags(for: packageManifest),
241+
"error expected"
242+
) { error in
243+
XCTAssertEqual(
244+
error as? StringError,
245+
StringError("invalid tools version")
246+
)
247+
}
248+
}
249+
250+
do {
251+
// Invalid package manifest should still produce build settings.
252+
let ws = try createWorkspace(
253+
"""
254+
// swift-tools-version:5.1
255+
import PackageDescription
256+
"""
257+
)
258+
259+
XCTAssertMatch(try ws.interpreterFlags(for: packageManifest), [.equal("-package-description-version"), .equal("5.1.0")])
260+
}
231261
}
232262
}
233263

0 commit comments

Comments
 (0)