Created
October 22, 2020 07:01
-
-
Save inamiy/7d97a439b7914563697868b6fdffa5af 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
import XCTest | |
import Combine | |
class DeinitTimingTests: XCTestCase { | |
func testExample() throws { | |
let publisher = PassthroughSubject<Void, Never>() | |
var cancellables = Set<AnyCancellable>() | |
var isDone = false | |
publisher | |
.sink { | |
isDone = true | |
} | |
.store(in: &cancellables) | |
// NOTE: `cancellables` will be deallocated here for release (-O) build. | |
publisher.send(()) | |
XCTAssertTrue(isDone) | |
// NOTE: `cancellables` will be deallocated here for debug build. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment