diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-19 06:05:58 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-19 06:05:58 +0000 |
commit | f58feecd36f4f3e954038b8ff3c256b79f1a04f5 (patch) | |
tree | e3cb587e82b3c0b6850a4134b89e0b8cb4aaab92 /test | |
parent | c5617b357ddfdaa9a05fce472c094a13ad58a470 (diff) | |
download | ruby-f58feecd36f4f3e954038b8ff3c256b79f1a04f5.tar.gz |
test_eval.rb: use block
* test/ruby/test_eval.rb (forall_TYPE): use block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_eval.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 299165fb34..360fcb3e10 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -127,19 +127,16 @@ class TestEval < Test::Unit::TestCase } end - def forall_TYPE(mid) + def forall_TYPE objects = [Object.new, [], nil, true, false, 77, :sym] # TODO: check objects.each do |obj| obj.instance_variable_set :@ivar, 12 - send mid, obj + yield obj end end def test_instance_eval_string_basic - forall_TYPE :instance_eval_string_basic_i - end - - def instance_eval_string_basic_i(o) + forall_TYPE do |o| assert_equal nil, o.instance_eval("nil") assert_equal true, o.instance_eval("true") assert_equal false, o.instance_eval("false") @@ -163,13 +160,11 @@ class TestEval < Test::Unit::TestCase assert_equal 14, o.instance_eval("$gvar__eval") assert_equal 15, o.instance_eval("Const") } + end end def test_instance_eval_block_basic - forall_TYPE :instance_eval_block_basic_i - end - - def instance_eval_block_basic_i(o) + forall_TYPE do |o| assert_equal nil, o.instance_eval { nil } assert_equal true, o.instance_eval { true } assert_equal false, o.instance_eval { false } @@ -193,6 +188,7 @@ class TestEval < Test::Unit::TestCase assert_equal 14, o.instance_eval { $gvar__eval } assert_equal 15, o.instance_eval { Const } } + end end def test_instance_eval_cvar |