Skip to content

Commit dc936c4

Browse files
committed
Fixup tests
1 parent 0f5aac0 commit dc936c4

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
@@ -262,10 +262,16 @@ struct InitTests {
262262
/// Tests creating packages with XCTest only.
263263
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
264264
func initPackageLibraryWithXCTestOnly(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
265+
#if canImport(TestingDisabled)
266+
let buildSys = buildSystem
267+
#else
268+
let buildSys: BuildSystemProvider.Kind? = nil
269+
#endif
270+
265271
try await createAndVerifyPackage(
266272
packageType: packageType,
267273
supportedTestingLibraries: [.xctest],
268-
buildSystem: buildSystem,
274+
buildSystem: buildSys,
269275
customVerification: { path, name in
270276
#expect(try localFileSystem.getDirectoryContents(path.appending("Sources").appending(name)) == ["\(name).swift"],
271277
"Expected single source file in Sources/\(name) directory")
@@ -282,10 +288,16 @@ struct InitTests {
282288
/// Tests creating packages with Swift Testing only.
283289
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
284290
func initPackagesWithSwiftTestingOnly(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
291+
#if canImport(TestingDisabled)
292+
let buildSys = buildSystem
293+
#else
294+
let buildSys: BuildSystemProvider.Kind? = nil
295+
#endif
296+
285297
try await createAndVerifyPackage(
286298
packageType: packageType,
287299
supportedTestingLibraries: [.swiftTesting],
288-
buildSystem: buildSystem,
300+
buildSystem: buildSys,
289301
customVerification: { path, name in
290302
try verifyTestFileContents(at: path, name: name, hasSwiftTesting: true, hasXCTest: false)
291303

@@ -300,10 +312,16 @@ struct InitTests {
300312
/// Tests creating packages with both Swift Testing and XCTest.
301313
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
302314
func initPackageWithBothSwiftTestingAndXCTest(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
315+
#if canImport(TestingDisabled)
316+
let buildSys = buildSystem
317+
#else
318+
let buildSys: BuildSystemProvider.Kind? = nil
319+
#endif
320+
303321
try await createAndVerifyPackage(
304322
packageType: packageType,
305323
supportedTestingLibraries: [.swiftTesting, .xctest],
306-
buildSystem: buildSystem,
324+
buildSystem: buildSys,
307325
customVerification: { path, name in
308326
try verifyTestFileContents(at: path, name: name, hasSwiftTesting: true, hasXCTest: true)
309327

@@ -318,10 +336,16 @@ struct InitTests {
318336
/// Tests creating packages with no testing libraries.
319337
@Test(arguments: [InitPackage.PackageType.library, .executable, .tool], [BuildSystemProvider.Kind.native, .swiftbuild])
320338
func initPackageWithNoTests(packageType: InitPackage.PackageType, buildSystem: BuildSystemProvider.Kind) async throws {
339+
#if canImport(TestingDisabled)
340+
let buildSys = buildSystem
341+
#else
342+
let buildSys: BuildSystemProvider.Kind? = nil
343+
#endif
344+
321345
try await createAndVerifyPackage(
322346
packageType: packageType,
323347
supportedTestingLibraries: [],
324-
buildSystem: buildSystem,
348+
buildSystem: buildSys,
325349
customVerification: { path, name in
326350
let manifestContents: String = try localFileSystem.readFileContents(path.appending("Package.swift"))
327351
#expect(!manifestContents.contains(#".testTarget"#))

0 commit comments

Comments
 (0)