Skip to content

Commit a5563a3

Browse files
authored
Merge pull request #166 from briancroom/discardable-result
Add @discardableResult annotation to applicable public API methods.
2 parents 3fb0aed + 3dc89f4 commit a5563a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/XCTest/Public/XCTestCase+Asynchronous.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public extension XCTestCase {
3939
/// between these environments. To ensure compatibility of tests between
4040
/// swift-corelibs-xctest and Apple XCTest, it is not recommended to pass
4141
/// explicit values for `file` and `line`.
42-
func expectation(description: String, file: StaticString = #file, line: UInt = #line) -> XCTestExpectation {
42+
@discardableResult func expectation(description: String, file: StaticString = #file, line: UInt = #line) -> XCTestExpectation {
4343
let expectation = XCTestExpectation(
4444
description: description,
4545
file: file,
@@ -164,7 +164,7 @@ public extension XCTestCase {
164164
/// notification is observed. It will not be invoked on timeout. Use the
165165
/// handler to further investigate if the notification fulfills the
166166
/// expectation.
167-
func expectation(forNotification notificationName: String, object objectToObserve: AnyObject?, handler: XCNotificationExpectationHandler? = nil) -> XCTestExpectation {
167+
@discardableResult func expectation(forNotification notificationName: String, object objectToObserve: AnyObject?, handler: XCNotificationExpectationHandler? = nil) -> XCTestExpectation {
168168
let objectDescription = objectToObserve == nil ? "any object" : "\(objectToObserve!)"
169169
let expectation = self.expectation(description: "Expect notification '\(notificationName)' from " + objectDescription)
170170
// Start observing the notification with specified name and object.
@@ -226,7 +226,7 @@ public extension XCTestCase {
226226
/// first successful evaluation will fulfill the expectation. If provided,
227227
/// the handler can override that behavior which leaves the caller
228228
/// responsible for fulfilling the expectation.
229-
func expectation(for predicate: NSPredicate, evaluatedWith object: AnyObject, file: StaticString = #file, line: UInt = #line, handler: XCPredicateExpectationHandler? = nil) -> XCTestExpectation {
229+
@discardableResult func expectation(for predicate: NSPredicate, evaluatedWith object: AnyObject, file: StaticString = #file, line: UInt = #line, handler: XCPredicateExpectationHandler? = nil) -> XCTestExpectation {
230230
let expectation = XCPredicateExpectation(
231231
predicate: predicate,
232232
object: object,

0 commit comments

Comments
 (0)