mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@15c9619
This commit is contained in:
parent
00c33d9c23
commit
a1b4816759
193 changed files with 3026 additions and 3387 deletions
|
@ -149,27 +149,25 @@ describe "String#match" do
|
|||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.4" do
|
||||
describe "String#match?" do
|
||||
before :each do
|
||||
# Resetting Regexp.last_match
|
||||
/DONTMATCH/.match ''
|
||||
end
|
||||
describe "String#match?" do
|
||||
before :each do
|
||||
# Resetting Regexp.last_match
|
||||
/DONTMATCH/.match ''
|
||||
end
|
||||
|
||||
context "when matches the given regex" do
|
||||
it "returns true but does not set Regexp.last_match" do
|
||||
'string'.match?(/string/i).should be_true
|
||||
Regexp.last_match.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it "returns false when does not match the given regex" do
|
||||
'string'.match?(/STRING/).should be_false
|
||||
end
|
||||
|
||||
it "takes matching position as the 2nd argument" do
|
||||
'string'.match?(/str/i, 0).should be_true
|
||||
'string'.match?(/str/i, 1).should be_false
|
||||
context "when matches the given regex" do
|
||||
it "returns true but does not set Regexp.last_match" do
|
||||
'string'.match?(/string/i).should be_true
|
||||
Regexp.last_match.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it "returns false when does not match the given regex" do
|
||||
'string'.match?(/STRING/).should be_false
|
||||
end
|
||||
|
||||
it "takes matching position as the 2nd argument" do
|
||||
'string'.match?(/str/i, 0).should be_true
|
||||
'string'.match?(/str/i, 1).should be_false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue