Skip to content

Instantly share code, notes, and snippets.

@polac24
Last active February 24, 2019 19:14
Show Gist options
  • Save polac24/169e919ec4376785d2c74d394baf6241 to your computer and use it in GitHub Desktop.
Save polac24/169e919ec4376785d2c74d394baf6241 to your computer and use it in GitHub Desktop.
func testListenerKeptWeakReferenceUsingTeardown() {
// Arrange
let sut = MasterClass()
let listener = MasterListener()
// Act
sut.add(listener)
// Assert
addTeardownBlock { [weak listener] in
XCTAssertNil(listener)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment