Sha256: 1c8a746e8df425690a0e2a27f8fe61cea661b9777f2915d9051ef6d2cf2555cc
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'test/unit' require_relative '../../ext/thread_frame' if '1.9.2' == RUBY_VERSION class TestInvalid < Test::Unit::TestCase def test_basic @tf = RubyVM::Frame::current assert_equal(false, @tf.invalid?, 'Frame should be valid right after RubyVM::Frame::current') def notgood(test_tf=nil) # FIXME # if test_tf # assert_equal(test_tf != @tf, test_tf.invalid?) # end return RubyVM::Frame::current end def inner_fn(tf) tf.invalid? end invalid_tf = notgood # FIXME: # assert_equal(true, invalid_tf.invalid?, # 'current thread frame should not be returned from a fn') # begin # b = invalid_tf.binding # assert false, 'Should have raised an ThreadFrameError' # rescue ThreadFrameError # assert true # end # Add a new local variable x = 5 assert_equal(false, @tf.invalid?, 'Frame should still be valid after adding more locals') assert_equal(false, inner_fn(@tf), 'outer thread frame should ok inside a called fn') notgood(invalid_tf) notgood(@tf) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rb-threadframe-0.41 | test/unit/test-invalid.rb |
rb-threadframe-0.40 | test/unit/test-invalid.rb |