diff options
Diffstat (limited to 'spec/ruby/library/stringscanner/scan_spec.rb')
-rw-r--r-- | spec/ruby/library/stringscanner/scan_spec.rb | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/spec/ruby/library/stringscanner/scan_spec.rb b/spec/ruby/library/stringscanner/scan_spec.rb index 2269abd6b3..ea711767b9 100644 --- a/spec/ruby/library/stringscanner/scan_spec.rb +++ b/spec/ruby/library/stringscanner/scan_spec.rb @@ -50,17 +50,9 @@ describe "StringScanner#scan" do @s.scan(/./).should be_nil end - ruby_version_is ""..."2.7" do - it "raises a TypeError if pattern is a String" do - -> { @s.scan("aoeu") }.should raise_error(TypeError) - end - end - - ruby_version_is "2.7" do - it "treats String as the pattern itself" do - @s.scan("this").should be_nil - @s.scan("This").should == "This" - end + it "treats String as the pattern itself" do + @s.scan("this").should be_nil + @s.scan("This").should == "This" end it "raises a TypeError if pattern isn't a Regexp nor String" do @@ -75,23 +67,21 @@ describe "StringScanner#scan with fixed_anchor: true" do @s = StringScanner.new("This\nis\na\ntest", fixed_anchor: true) end - ruby_version_is "2.7" do - it "returns the matched string" do - @s.scan(/\w+/).should == "This" - @s.scan(/.../m).should == "\nis" - @s.scan(//).should == "" - @s.scan(/\s+/).should == "\n" - end + it "returns the matched string" do + @s.scan(/\w+/).should == "This" + @s.scan(/.../m).should == "\nis" + @s.scan(//).should == "" + @s.scan(/\s+/).should == "\n" + end - it "treats ^ as matching from the beginning of line" do - @s.scan(/\w+\n/).should == "This\n" - @s.scan(/^\w/).should == "i" - @s.scan(/^\w/).should be_nil - end + it "treats ^ as matching from the beginning of line" do + @s.scan(/\w+\n/).should == "This\n" + @s.scan(/^\w/).should == "i" + @s.scan(/^\w/).should be_nil + end - it "treats \\A as matching from the beginning of string" do - @s.scan(/\A\w/).should == "T" - @s.scan(/\A\w/).should be_nil - end + it "treats \\A as matching from the beginning of string" do + @s.scan(/\A\w/).should == "T" + @s.scan(/\A\w/).should be_nil end end |