Created
December 26, 2013 12:57
-
-
Save hboon/8133537 to your computer and use it in GitHub Desktop.
testing for #dealloc called. #use_weak_callbacks is suppose to call #weak! on procs to break cyclic references.
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
it "verify #use_weak_callbacks" do | |
class ButtonParentView1 < UIView | |
def dealloc | |
p "dealloc #{self} tag: #{tag}" | |
super | |
end | |
def create_btn | |
sub2 = UIControl.alloc.init | |
sub2.when(UIControlEventTouchUpInside) do | |
end | |
addSubview(sub2) | |
end | |
end | |
BubbleWrap.use_weak_callbacks = true | |
v1 = ButtonParentView1.new | |
v1.tag = 1 | |
v1.create_btn | |
BubbleWrap.use_weak_callbacks = false | |
v2 = ButtonParentView1.new | |
v2.tag = 2 | |
v2.create_btn | |
#how do we verify that v1 has been #dealloc and not v2? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment