diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_eval.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 9d8db3017b..02dbb9b379 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -126,6 +126,10 @@ class TestEval < Test::Unit::TestCase } end + def test_module_eval_block_symbol + assert_equal "Math", Math.module_eval(&:to_s) + end + def forall_TYPE objects = [Object.new, [], nil, true, false] # TODO: check objects.each do |obj| @@ -199,6 +203,12 @@ class TestEval < Test::Unit::TestCase assert_equal self, pr.call end + def test_instance_eval_block_symbol + forall_TYPE do |o| + assert_equal o.to_s, o.instance_eval(&:to_s) + end + end + def test_instance_eval_cvar [Object.new, [], 7, :sym, true, false, nil].each do |obj| assert_equal(13, obj.instance_eval("@@cvar")) |