Skip to content

Commit d397ecd

Browse files
committed
Don't crash in tests in CodeGenerationToolTests don't have a compile task, emit a test issue instead.
rdar://153135551
1 parent 44f5172 commit d397ecd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Tests/SWBBuildSystemTests/CodeGenerationToolTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fileprivate struct CodeGenerationToolTests: CoreBasedTests {
176176
break
177177
}
178178

179-
let compileTask = compileTasks[0]
179+
let compileTask = try #require(compileTasks.first, "No compile task found for target '\(targetName)'.")
180180

181181
if targetName == "CoreFoo" {
182182
#expect(results.getTasks(.matchRuleType("CompileC"), .matchRuleItemBasename("CoreFoo.m"), .matchTargetName(targetName)).count == 1)
@@ -432,7 +432,7 @@ fileprivate struct CodeGenerationToolTests: CoreBasedTests {
432432
break
433433
}
434434

435-
let compileTask = compileTasks[0]
435+
let compileTask = try #require(compileTasks.first, "No compile task found for target '\(targetName)'.")
436436

437437
if targetName == "CoreFoo" {
438438
#expect(results.getTasks(.matchRuleType("CompileC"), .matchRuleItemBasename("CoreFoo.m"), .matchTargetName(targetName)).count == 1)
@@ -642,7 +642,7 @@ fileprivate struct CodeGenerationToolTests: CoreBasedTests {
642642
break
643643
}
644644

645-
let compileTask = compileTasks[0]
645+
let compileTask = try #require(compileTasks.first, "No compile task found for target '\(targetName)'.")
646646

647647
if targetName == "CoreFoo" {
648648
#expect(results.getTasks(.matchRuleType("CompileC"), .matchRuleItemBasename("CoreFoo.m"), .matchTargetName(targetName)).count == 1)

0 commit comments

Comments
 (0)