diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-26 10:10:41 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-26 10:10:41 +0000 |
commit | 3802fb92ff8c83eed3e867db20f72c53932f542d (patch) | |
tree | 1546344edc8073c122cd47fb567f031a1ebb4551 /test/ruby/test_eval.rb | |
parent | 62a3e7a33b24f851bb6c9658925a4bf30655e70c (diff) |
parse.y: warning for locations
* parse.y (gettable_gen): warn for __FILE__/__LINE__ when eval
with binding only. promote use of Binding#source_location
instead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_eval.rb')
-rw-r--r-- | test/ruby/test_eval.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 0bc0390d64..eba00f80bd 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -503,6 +503,12 @@ class TestEval < Test::Unit::TestCase assert_same a, b end + def test_eval_location_binding + assert_warning(/__FILE__ in eval/) do + assert_equal(__FILE__, eval("__FILE__", binding)) + end + end + def test_fstring_instance_eval bug = "[ruby-core:78116] [Bug #12930]".freeze assert_same bug, (bug.instance_eval {self}) |