Last active
May 19, 2016 00:56
-
-
Save djberg96/649c423d6a338d6b4694b5cbde77205c 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
require 'test/unit' | |
require 'weakref' | |
# Result: <WeakRef::RefError> exception expected but none was thrown - why? | |
class TC_Stdlib_WeakRef < Test::Unit::TestCase | |
test "weakref raises an error on garbage collected ref" do | |
str = 'hello' | |
ref = WeakRef.new(str) | |
str = nil | |
GC.start | |
assert_raise(WeakRef::RefError){ ref.to_s } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment