From b49307c701911a713cbdb48367833d3661a4880a Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 28 Aug 2020 20:26:02 +0200 Subject: Update to ruby/spec@335eb9b --- spec/ruby/language/BEGIN_spec.rb | 5 +++++ spec/ruby/language/regexp_spec.rb | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'spec/ruby/language') 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' }" diff --git a/spec/ruby/language/regexp_spec.rb b/spec/ruby/language/regexp_spec.rb index ac3f773c49..059428ec69 100644 --- a/spec/ruby/language/regexp_spec.rb +++ b/spec/ruby/language/regexp_spec.rb @@ -115,6 +115,12 @@ describe "Literal Regexps" do /foo.(?<=\d)/.match("fooA foo1").to_a.should == ["foo1"] end + # https://bugs.ruby-lang.org/issues/13671 + it "raises a RegexpError for lookbehind with specific characters" do + r = Regexp.new("(? { r =~ "✨" }.should raise_error(RegexpError) + end + it "supports (?