diff options
author | Benoit Daloze <eregontp@gmail.com> | 2021-10-20 21:41:46 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2021-10-20 21:41:46 +0200 |
commit | a6c6eef04aaa075f4bbd0eef740d011737afec91 (patch) | |
tree | e8779ca2ddc044899caabca88c16abc9a9054fff /spec/ruby/core/binding/eval_spec.rb | |
parent | 207a5a5bc13018344dc2ab7913fdcaeaeca01292 (diff) |
Update to ruby/spec@d6921ef
Diffstat (limited to 'spec/ruby/core/binding/eval_spec.rb')
-rw-r--r-- | spec/ruby/core/binding/eval_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/ruby/core/binding/eval_spec.rb b/spec/ruby/core/binding/eval_spec.rb index b36bec799e..4bb3da7a6c 100644 --- a/spec/ruby/core/binding/eval_spec.rb +++ b/spec/ruby/core/binding/eval_spec.rb @@ -93,16 +93,28 @@ describe "Binding#eval" do it "inherits __FILE__ from the enclosing scope" do obj = BindingSpecs::Demo.new(1) bind = obj.get_binding - suppress_warning {bind.eval("__FILE__")}.should == obj.get_file_of_binding + suppress_warning { bind.eval("__FILE__") }.should == obj.get_file_of_binding + end + + it "inherits __LINE__ from the enclosing scope" do + obj = BindingSpecs::Demo.new(1) + bind, line = obj.get_binding_and_line + suppress_warning { bind.eval("__LINE__") }.should == line end end ruby_version_is "3.0" do - it "Uses (eval) as __FILE__ if single argument given" do + it "uses (eval) as __FILE__ if single argument given" do obj = BindingSpecs::Demo.new(1) bind = obj.get_binding bind.eval("__FILE__").should == '(eval)' end + + it "uses 1 as __LINE__" do + obj = BindingSpecs::Demo.new(1) + bind = obj.get_binding + suppress_warning { bind.eval("__LINE__") }.should == 1 + end end it "uses the __FILE__ that is passed in" do |