Skip to content

Instantly share code, notes, and snippets.

@hboon
Created December 26, 2013 12:57
Show Gist options
  • Save hboon/8133537 to your computer and use it in GitHub Desktop.
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.
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