diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-29 08:58:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-29 08:58:04 +0000 |
commit | e3f88ac44d5068049e6dce1aa21ddb1ad30b24a4 (patch) | |
tree | 8c0ddeee334da6c0e29136ebd70635a4b65aa3bf /test | |
parent | 68fa2e8caea5814bb37df79ac1294171c88c99ca (diff) | |
download | ruby-e3f88ac44d5068049e6dce1aa21ddb1ad30b24a4.tar.gz |
test_settracefunc.rb: fix tests
* test/ruby/test_settracefunc.rb (assert_security_error_safe4): fix
tests to set $SAFE separatedly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index e7c010aaaf..b0c6f2bcca 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -397,34 +397,38 @@ class TestSetTraceFunc < Test::Unit::TestCase assert_equal(self, ok, bug3921) end - def assert_security_error_safe4 - func = lambda { - $SAFE = 4 - proc {yield} - }.call - assert_raise(SecurityError, &func) + def assert_security_error_safe4(block) + assert_raise(SecurityError) do + block.call + end end def test_set_safe4 - assert_security_error_safe4 do + func = proc do + $SAFE = 4 set_trace_func(lambda {|*|}) end + assert_security_error_safe4(func) end def test_thread_set_safe4 th = Thread.start {sleep} - assert_security_error_safe4 do + func = proc do + $SAFE = 4 th.set_trace_func(lambda {|*|}) end + assert_security_error_safe4(func) ensure th.kill end def test_thread_add_safe4 th = Thread.start {sleep} - assert_security_error_safe4 do + func = proc do + $SAFE = 4 th.add_trace_func(lambda {|*|}) end + assert_security_error_safe4(func) ensure th.kill end @@ -922,15 +926,19 @@ class TestSetTraceFunc < Test::Unit::TestCase def test_trace_point_enable_safe4 tp = TracePoint.new {} - assert_security_error_safe4 do + func = proc do + $SAFE = 4 tp.enable end + assert_security_error_safe4(func) end def test_trace_point_disable_safe4 tp = TracePoint.new {} - assert_security_error_safe4 do + func = proc do + $SAFE = 4 tp.disable end + assert_security_error_safe4(func) end end |