Skip to content

Commit f9b9089

Browse files
committed
[XCTAssert] Specify where XCTAssert may be used
The XCTAssert* family of functions require that XCTCurrentTestCase is set. Failures that occur outside of these conditions are never reported.
1 parent 28340aa commit f9b9089

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

XCTest/XCTAssert.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
/// are implemented in terms of this. This function emits a test failure if the
1515
/// general Bool expression passed to it evaluates to false.
1616
///
17+
/// - Requires: This and all other XCTAssert* functions must be called from
18+
/// within a test method, as indicated by `XCTestCaseProvider.allTests`.
19+
/// Assertion failures that occur outside of a test method will *not* be
20+
/// reported as failures.
21+
///
1722
/// - Parameter expression: A boolean test. If it evaluates to false, the
1823
/// assertion fails and emits a test failure.
1924
/// - Parameter message: An optional message to use in the failure if the

0 commit comments

Comments
 (0)