mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
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
This commit is contained in:
parent
62a3e7a33b
commit
3802fb92ff
3 changed files with 52 additions and 4 deletions
|
@ -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})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue