diff options
author | Benoit Daloze <[email protected]> | 2020-08-28 20:26:02 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2020-08-28 20:26:02 +0200 |
commit | b49307c701911a713cbdb48367833d3661a4880a (patch) | |
tree | 75674a3f22bee0b347b3efbbcc160bc7a637b8e3 /spec/ruby/language/BEGIN_spec.rb | |
parent | 3dd63108b0e7551aba76eba85a459b58ec971ccb (diff) |
Update to ruby/spec@335eb9b
Diffstat (limited to 'spec/ruby/language/BEGIN_spec.rb')
-rw-r--r-- | spec/ruby/language/BEGIN_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/language/BEGIN_spec.rb b/spec/ruby/language/BEGIN_spec.rb index 58cc2bebfb..5aef5a1d7c 100644 --- a/spec/ruby/language/BEGIN_spec.rb +++ b/spec/ruby/language/BEGIN_spec.rb @@ -18,6 +18,11 @@ describe "The BEGIN keyword" do -> { eval "1.times { BEGIN { 1 } }" }.should raise_error(SyntaxError) end + it "uses top-level for self" do + eval("BEGIN { ScratchPad << self.to_s }", TOPLEVEL_BINDING) + ScratchPad.recorded.should == ['main'] + end + it "runs first in a given code unit" do eval "ScratchPad << 'foo'; BEGIN { ScratchPad << 'bar' }" |