summaryrefslogtreecommitdiff
path: root/spec/ruby/language/regexp_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/regexp_spec.rb')
-rw-r--r--spec/ruby/language/regexp_spec.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/ruby/language/regexp_spec.rb b/spec/ruby/language/regexp_spec.rb
index 0cd9584549..1452b01935 100644
--- a/spec/ruby/language/regexp_spec.rb
+++ b/spec/ruby/language/regexp_spec.rb
@@ -15,7 +15,7 @@ describe "Literal Regexps" do
end
it "yields a Regexp" do
- /Hello/.should be_kind_of(Regexp)
+ /Hello/.should.is_a?(Regexp)
end
it "is frozen" do
@@ -27,11 +27,11 @@ describe "Literal Regexps" do
2.times do |i|
rs << /foo/
end
- rs[0].should equal(rs[1])
+ rs[0].should.equal?(rs[1])
end
it "throws SyntaxError for malformed literals" do
- -> { eval('/(/') }.should raise_error(SyntaxError)
+ -> { eval('/(/') }.should.raise(SyntaxError)
end
#############################################################################
@@ -58,7 +58,7 @@ describe "Literal Regexps" do
it "disallows first part of paired delimiters to be used as non-paired delimiters" do
LanguageSpecs.paired_delimiters.each do |p0, p1|
- -> { eval("%r#{p0} foo #{p0}") }.should raise_error(SyntaxError)
+ -> { eval("%r#{p0} foo #{p0}") }.should.raise(SyntaxError)
end
end
@@ -69,11 +69,11 @@ describe "Literal Regexps" do
end
it "disallows alphabets as non-paired delimiter with %r" do
- -> { eval('%ra foo a') }.should raise_error(SyntaxError)
+ -> { eval('%ra foo a') }.should.raise(SyntaxError)
end
it "disallows spaces after %r and delimiter" do
- -> { eval('%r !foo!') }.should raise_error(SyntaxError)
+ -> { eval('%r !foo!') }.should.raise(SyntaxError)
end
it "allows unescaped / to be used with %r" do
@@ -89,8 +89,8 @@ describe "Literal Regexps" do
# Basic matching
/./.match("foo").to_a.should == ["f"]
# Basic non-matching
- /./.match("").should be_nil
- /./.match("\n").should be_nil
+ /./.match("").should == nil
+ /./.match("\n").should == nil
/./.match("\0").to_a.should == ["\0"]
end
@@ -100,7 +100,7 @@ describe "Literal Regexps" do
it "supports (?> ) (embedded subexpression)" do
/(?>foo)(?>bar)/.match("foobar").to_a.should == ["foobar"]
- /(?>foo*)obar/.match("foooooooobar").should be_nil # it is possessive
+ /(?>foo*)obar/.match("foooooooobar").should == nil # it is possessive
end
it "supports (?# )" do
@@ -112,7 +112,7 @@ describe "Literal Regexps" do
/foo.(?<=\d)/.match("fooA foo1").to_a.should == ["foo1"]
end
- ruby_bug "#13671", ""..."3.6" do # https://bugs.ruby-lang.org/issues/13671
+ ruby_bug "#13671", ""..."4.0" do # https://bugs.ruby-lang.org/issues/13671
it "handles a lookbehind with ss characters" do
r = Regexp.new("(?<!dss)", Regexp::IGNORECASE)
r.should =~ "✨"
@@ -135,9 +135,9 @@ describe "Literal Regexps" do
it "supports possessive quantifiers" do
/fooA++bar/.match("fooAAAbar").to_a.should == ["fooAAAbar"]
- /fooA++Abar/.match("fooAAAbar").should be_nil
- /fooA?+Abar/.match("fooAAAbar").should be_nil
- /fooA*+Abar/.match("fooAAAbar").should be_nil
+ /fooA++Abar/.match("fooAAAbar").should == nil
+ /fooA?+Abar/.match("fooAAAbar").should == nil
+ /fooA*+Abar/.match("fooAAAbar").should == nil
end
it "supports conditional regular expressions with positional capture groups" do