Last active
February 24, 2019 10:56
-
-
Save polac24/5373365f44b72e1a6a7026b5a669c244 to your computer and use it in GitHub Desktop.
This file contains 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 testCallbackIsNotCalledAfterCancel() { | |
// Arrange | |
let sut = MasterClass() | |
// Act | |
let tokenMarker = weaklyScoped(NSObject()) { marker in | |
sut.start { | |
// keep a strong reference to a marker | |
_ = marker | |
} | |
// cancel should clear start's completion | |
sut.cancel() | |
} | |
//Assert | |
XCTAssertNil(tokenMarker) | |
} | |
func testStartedMasterDeallocates() { | |
// Act | |
let weakSut = weaklyScoped(MasterClass()) { sut in | |
sut.start { } | |
} | |
// Assert | |
XCTAssertNil(weakSut) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment