diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-11 05:37:32 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-11 05:37:32 +0000 |
commit | cc3088ea519efa279e4aa71fb994328a9080483f (patch) | |
tree | 45b5736589c617e0fff1848094c3c7d74663d0e7 /test/ruby | |
parent | d2d4017d8099c22dec6913b0f0b938dd8ef21850 (diff) | |
download | ruby-cc3088ea519efa279e4aa71fb994328a9080483f.tar.gz |
* include/ruby/ruby.h: freeze nil/true/false.
* gc.c (should_be_finalizable): check frozen after checkin FL_ABLE.
* object.c (rb_obj_taint): check
OBJ_TAINTABLE(obj).
* object.c (rb_obj_freeze): remove immediate_frozen_tbl
because all of immediate values are frozen. YAY!
* object.c (rb_obj_frozen_p): ditto.
* test/ruby/test_eval.rb: skip instance_variable_set for
frozen objects.
* test/ruby/test_weakmap.rb: check ArgumentError instead of
RuntimeError.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_eval.rb | 10 | ||||
-rw-r--r-- | test/ruby/test_weakmap.rb | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index c05adc08e3..2aa5e6b367 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -130,7 +130,7 @@ class TestEval < Test::Unit::TestCase def forall_TYPE objects = [Object.new, [], nil, true, false] # TODO: check objects.each do |obj| - obj.instance_variable_set :@ivar, 12 + obj.instance_variable_set :@ivar, 12 unless obj.frozen? yield obj end end @@ -145,7 +145,7 @@ class TestEval < Test::Unit::TestCase assert_equal :sym, o.instance_eval(":sym") assert_equal 11, o.instance_eval("11") - assert_equal 12, o.instance_eval("@ivar") + assert_equal 12, o.instance_eval("@ivar") unless o.frozen? assert_equal 13, o.instance_eval("@@cvar") assert_equal 14, o.instance_eval("$gvar__eval") assert_equal 15, o.instance_eval("Const") @@ -155,7 +155,7 @@ class TestEval < Test::Unit::TestCase assert_equal "19", o.instance_eval(%q("1#{9}")) 1.times { - assert_equal 12, o.instance_eval("@ivar") + assert_equal 12, o.instance_eval("@ivar") unless o.frozen? assert_equal 13, o.instance_eval("@@cvar") assert_equal 14, o.instance_eval("$gvar__eval") assert_equal 15, o.instance_eval("Const") @@ -173,7 +173,7 @@ class TestEval < Test::Unit::TestCase assert_equal :sym, o.instance_eval { :sym } assert_equal 11, o.instance_eval { 11 } - assert_equal 12, o.instance_eval { @ivar } + assert_equal 12, o.instance_eval { @ivar } unless o.frozen? assert_equal 13, o.instance_eval { @@cvar } assert_equal 14, o.instance_eval { $gvar__eval } assert_equal 15, o.instance_eval { Const } @@ -183,7 +183,7 @@ class TestEval < Test::Unit::TestCase assert_equal "19", o.instance_eval { "1#{9}" } 1.times { - assert_equal 12, o.instance_eval { @ivar } + assert_equal 12, o.instance_eval { @ivar } unless o.frozen? assert_equal 13, o.instance_eval { @@cvar } assert_equal 14, o.instance_eval { $gvar__eval } assert_equal 15, o.instance_eval { Const } diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb index bcaab894a7..94590a07ff 100644 --- a/test/ruby/test_weakmap.rb +++ b/test/ruby/test_weakmap.rb @@ -19,13 +19,13 @@ class TestWeakMap < Test::Unit::TestCase assert_raise(ArgumentError) {@wm[true] = x} assert_raise(ArgumentError) {@wm[false] = x} assert_raise(ArgumentError) {@wm[nil] = x} - assert_raise(RuntimeError) {@wm[42] = x} - assert_raise(RuntimeError) {@wm[:foo] = x} + assert_raise(ArgumentError) {@wm[42] = x} + assert_raise(ArgumentError) {@wm[:foo] = x} assert_raise(ArgumentError) {@wm[x] = true} assert_raise(ArgumentError) {@wm[x] = false} assert_raise(ArgumentError) {@wm[x] = nil} - assert_raise(RuntimeError) {@wm[x] = 42} - assert_raise(RuntimeError) {@wm[x] = :foo} + assert_raise(ArgumentError) {@wm[x] = 42} + assert_raise(ArgumentError) {@wm[x] = :foo} end def test_include? |