aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/language/regexp
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-04-27 18:53:23 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-04-27 18:53:23 +0200
commita1b4816759418ca8fe510e8739622fc5d77ab0f0 (patch)
tree9d4fb6091d0086817f5bde46bf1150e9130d34fd /spec/ruby/language/regexp
parent00c33d9c232ed1a79eda17acd7231ac93caa162b (diff)
downloadruby-a1b4816759418ca8fe510e8739622fc5d77ab0f0.tar.gz
Update to ruby/spec@15c9619
Diffstat (limited to 'spec/ruby/language/regexp')
-rw-r--r--spec/ruby/language/regexp/character_classes_spec.rb30
-rw-r--r--spec/ruby/language/regexp/modifiers_spec.rb8
-rw-r--r--spec/ruby/language/regexp/repetition_spec.rb17
3 files changed, 21 insertions, 34 deletions
diff --git a/spec/ruby/language/regexp/character_classes_spec.rb b/spec/ruby/language/regexp/character_classes_spec.rb
index a466f745ae..c0f69bea9b 100644
--- a/spec/ruby/language/regexp/character_classes_spec.rb
+++ b/spec/ruby/language/regexp/character_classes_spec.rb
@@ -609,25 +609,23 @@ describe "Regexp with character classes" do
"루비(Ruby)".match(/\p{Hangul}+/u).to_a.should == ["루비"]
end
- ruby_version_is "2.4" do
- it "supports \\X (unicode 9.0 with UTR #51 workarounds)" do
- # simple emoji without any fancy modifier or ZWJ
- /\X/.match("\u{1F98A}").to_a.should == ["🦊"]
+ it "supports \\X (unicode 9.0 with UTR #51 workarounds)" do
+ # simple emoji without any fancy modifier or ZWJ
+ /\X/.match("\u{1F98A}").to_a.should == ["🦊"]
- # skin tone modifier
- /\X/.match("\u{1F918}\u{1F3FD}").to_a.should == ["🀘🏽"]
+ # skin tone modifier
+ /\X/.match("\u{1F918}\u{1F3FD}").to_a.should == ["🀘🏽"]
- # emoji joined with ZWJ
- /\X/.match("\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}").to_a.should == ["πŸ³οΈβ€πŸŒˆ"]
- /\X/.match("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").to_a.should == ["πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦"]
+ # emoji joined with ZWJ
+ /\X/.match("\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}").to_a.should == ["πŸ³οΈβ€πŸŒˆ"]
+ /\X/.match("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").to_a.should == ["πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦"]
- # without the ZWJ
- /\X+/.match("\u{1F3F3}\u{FE0F}\u{1F308}").to_a.should == ["🏳️🌈"]
- /\X+/.match("\u{1F469}\u{1F469}\u{1F467}\u{1F466}").to_a.should == ["πŸ‘©πŸ‘©πŸ‘§πŸ‘¦"]
+ # without the ZWJ
+ /\X+/.match("\u{1F3F3}\u{FE0F}\u{1F308}").to_a.should == ["🏳️🌈"]
+ /\X+/.match("\u{1F469}\u{1F469}\u{1F467}\u{1F466}").to_a.should == ["πŸ‘©πŸ‘©πŸ‘§πŸ‘¦"]
- # both of the ZWJ combined
- /\X+/.match("\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}")
- .to_a.should == ["πŸ³οΈβ€πŸŒˆπŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦"]
- end
+ # both of the ZWJ combined
+ /\X+/.match("\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}")
+ .to_a.should == ["πŸ³οΈβ€πŸŒˆπŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦"]
end
end
diff --git a/spec/ruby/language/regexp/modifiers_spec.rb b/spec/ruby/language/regexp/modifiers_spec.rb
index 7c78e67e2b..f0051ca55d 100644
--- a/spec/ruby/language/regexp/modifiers_spec.rb
+++ b/spec/ruby/language/regexp/modifiers_spec.rb
@@ -39,11 +39,9 @@ describe "Regexps with modifiers" do
lambda { eval('/foo/a') }.should raise_error(SyntaxError)
end
- ruby_version_is "2.4" do
- it "supports (?~) (absent operator)" do
- Regexp.new("(?~foo)").match("hello").to_a.should == ["hello"]
- "foo".scan(Regexp.new("(?~foo)")).should == ["fo","o",""]
- end
+ it "supports (?~) (absent operator)" do
+ Regexp.new("(?~foo)").match("hello").to_a.should == ["hello"]
+ "foo".scan(Regexp.new("(?~foo)")).should == ["fo","o",""]
end
it "supports (?imx-imx) (inline modifiers)" do
diff --git a/spec/ruby/language/regexp/repetition_spec.rb b/spec/ruby/language/regexp/repetition_spec.rb
index 5d400dec6f..7bb767ccaf 100644
--- a/spec/ruby/language/regexp/repetition_spec.rb
+++ b/spec/ruby/language/regexp/repetition_spec.rb
@@ -34,20 +34,11 @@ describe "Regexps with repetition" do
/.([0-9]){3,5}?foo/.match("9876543210foo").to_a.should == ["543210foo", "0"]
end
- ruby_version_is ""..."2.4" do
- it "does not treat {m,n}+ as possessive" do
+ it "does not treat {m,n}+ as possessive" do
+ -> {
@regexp = eval "/foo(A{0,1}+)Abar/"
- @regexp.match("fooAAAbar").to_a.should == ["fooAAAbar", "AA"]
- end
- end
-
- ruby_version_is "2.4" do
- it "does not treat {m,n}+ as possessive" do
- -> {
- @regexp = eval "/foo(A{0,1}+)Abar/"
- }.should complain(/nested repeat operator/)
- @regexp.match("fooAAAbar").to_a.should == ["fooAAAbar", "AA"]
- end
+ }.should complain(/nested repeat operator/)
+ @regexp.match("fooAAAbar").to_a.should == ["fooAAAbar", "AA"]
end
it "supports ? (0 or 1 of previous subexpression)" do