mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
respect current frame of rb_eval_string
`self` is nearest Ruby method's `self`. If there is no ruby frame, use toplevel `self` (`main`). https://bugs.ruby-lang.org/issues/18780
This commit is contained in:
parent
1520936aa7
commit
5bbba76489
Notes:
git
2022-08-01 17:48:36 +09:00
4 changed files with 31 additions and 1 deletions
12
test/-ext-/eval/test_eval.rb
Normal file
12
test/-ext-/eval/test_eval.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
require "-test-/eval"
|
||||
|
||||
class EvalTest < Test::Unit::TestCase
|
||||
def test_rb_eval_string
|
||||
a = 1
|
||||
assert_equal [self, 1, __method__], rb_eval_string(%q{
|
||||
[self, a, __method__]
|
||||
})
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue