Skip to content

Commit aa33e18

Browse files
committed
Replace force unwrapping with XCTUnwrap for safer tests
Use XCTUnwrap() instead of force unwrapping to handle potential nil values more gracefully and prevent test traps, as suggested in PR review.
1 parent ded8478 commit aa33e18

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContext+RootPageTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class DocumentationContext_RootPageTests: XCTestCase {
212212
// Verify each warning has a solution to remove the TechnologyRoot directive
213213
for problem in multipleRootsProblems {
214214
XCTAssertEqual(problem.possibleSolutions.count, 1)
215-
let solution = problem.possibleSolutions.first!
215+
let solution = try XCTUnwrap(problem.possibleSolutions.first)
216216
XCTAssertEqual(solution.summary, "Remove the 'TechnologyRoot' directive")
217217
XCTAssertEqual(solution.replacements.count, 1)
218218
}

0 commit comments

Comments
 (0)