Skip to content

Commit ce0cf11

Browse files
committed
Fixup tests
1 parent d044391 commit ce0cf11

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

Tests/WorkspaceTests/InitTests.swift

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,16 @@ struct InitTests {
260260
/// Tests creating packages with XCTest only.
261261
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
262262
func initPackageLibraryWithXCTestOnly(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
263+
#if canImport(TestingDisabled)
264+
let buildSys = buildSystem
265+
#else
266+
let buildSys: BuildSystemProvider.Kind? = nil
267+
#endif
268+
263269
try await createAndVerifyPackage(
264270
packageType: packageType,
265271
supportedTestingLibraries: [.xctest],
266-
buildSystem: buildSystem,
272+
buildSystem: buildSys,
267273
customVerification: { path, name in
268274
#expect(try localFileSystem.getDirectoryContents(path.appending("Sources").appending(name)) == ["\(name).swift"],
269275
"Expected single source file in Sources/\(name) directory")
@@ -280,10 +286,16 @@ struct InitTests {
280286
/// Tests creating packages with Swift Testing only.
281287
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
282288
func initPackagesWithSwiftTestingOnly(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
289+
#if canImport(TestingDisabled)
290+
let buildSys = buildSystem
291+
#else
292+
let buildSys: BuildSystemProvider.Kind? = nil
293+
#endif
294+
283295
try await createAndVerifyPackage(
284296
packageType: packageType,
285297
supportedTestingLibraries: [.swiftTesting],
286-
buildSystem: buildSystem,
298+
buildSystem: buildSys,
287299
customVerification: { path, name in
288300
try verifyTestFileContents(at: path, name: name, hasSwiftTesting: true, hasXCTest: false)
289301

@@ -298,10 +310,16 @@ struct InitTests {
298310
/// Tests creating packages with both Swift Testing and XCTest.
299311
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
300312
func initPackageWithBothSwiftTestingAndXCTest(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
313+
#if canImport(TestingDisabled)
314+
let buildSys = buildSystem
315+
#else
316+
let buildSys: BuildSystemProvider.Kind? = nil
317+
#endif
318+
301319
try await createAndVerifyPackage(
302320
packageType: packageType,
303321
supportedTestingLibraries: [.swiftTesting, .xctest],
304-
buildSystem: buildSystem,
322+
buildSystem: buildSys,
305323
customVerification: { path, name in
306324
try verifyTestFileContents(at: path, name: name, hasSwiftTesting: true, hasXCTest: true)
307325

@@ -316,10 +334,16 @@ struct InitTests {
316334
/// Tests creating packages with no testing libraries.
317335
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
318336
func initPackageWithNoTests(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
337+
#if canImport(TestingDisabled)
338+
let buildSys = buildSystem
339+
#else
340+
let buildSys: BuildSystemProvider.Kind? = nil
341+
#endif
342+
319343
try await createAndVerifyPackage(
320344
packageType: packageType,
321345
supportedTestingLibraries: [],
322-
buildSystem: buildSystem,
346+
buildSystem: buildSys,
323347
customVerification: { path, name in
324348
let manifestContents: String = try localFileSystem.readFileContents(path.appending("Package.swift"))
325349
#expect(!manifestContents.contains(#".testTarget"#))

0 commit comments

Comments
 (0)