Open
Description
Previous ID | SR-14597 |
Radar | rdar://problem/77673444 |
Original Reporter | arhaiziya (JIRA User) |
Type | Bug |
Attachment: Download
Environment
Xcode: 12.4 (12D4e)
Swift 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Additional Detail from JIRA
Votes | 0 |
Component/s | XCTest |
Labels | Bug, Documentation, StarterBug |
Assignee | jiaren wang (JIRA) |
Priority | Medium |
md5: 774aff3193998de82f1751fe0c87c0b9
Issue Description:
Documentation for expectedfulfillmentcount has the following note:
The value of expectedFulfillmentCount is ignored when isInverted is true.
However, the following snippet shows different behavior. The first test succeeded and the second one did not (see attachments for test results).
import XCTest
class SomeTestCase: XCTestCase {
func testExpectationFulfilled() {
let expectation = XCTestExpectation()
expectation.expectedFulfillmentCount = 3
expectation.isInverted = true
expectation.fulfill()
expectation.fulfill()
wait(for: [expectation], timeout: 1.0)
}
func testExpectationNotFulfilled() {
let expectation = XCTestExpectation()
expectation.isInverted = true
expectation.expectedFulfillmentCount = 3
expectation.fulfill()
expectation.fulfill()
expectation.fulfill()
wait(for: [expectation], timeout: 1.0)
}
}
Looks like a bug in docs or the behavior, but expectedFulfillmentCount is surely not ignored and is used as a threshold value.