Created
August 30, 2021 11:58
-
-
Save iSapozhnik/8bd714e71c392bebef27fe58a6004ac3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func test(with identifier: String = #function, body: (XCTestExpectation) -> Void) { | |
let expectation = expectation(description: identifier) | |
body(expectation) | |
waitForExpectations(timeout: 0.5) | |
} | |
func testAscending() { | |
let a = [1] | |
test { expectation in | |
a.publisher.sink { value in | |
XCTAssert(value == 2) | |
expectation.fulfill() | |
}.store(in: &cancellables) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment