@@ -49,8 +49,7 @@ describe "Regex::MatchData" do
49
49
end
50
50
51
51
it " captures duplicated named group" do
52
- # TODO: replace with regexp literal after next version release
53
- re = Regex .new " (?:(?<g1>foo)|(?<g1>bar))*"
52
+ re = /(?:(?<g1>foo) |(?<g1>bar) ) */
54
53
55
54
(" foo" =~ re).should eq(0 )
56
55
$~ [" g1" ].should eq(" foo" )
@@ -116,8 +115,7 @@ describe "Regex::MatchData" do
116
115
end
117
116
118
117
it " captures duplicated named group" do
119
- # TODO: replace with regexp literal after next version release
120
- re = Regex .new " (?:(?<g1>foo)|(?<g1>bar))*"
118
+ re = /(?:(?<g1>foo) |(?<g1>bar) ) */
121
119
122
120
(" foo" =~ re).should eq(0 )
123
121
$~ [" g1" ]?.should eq(" foo" )
@@ -203,8 +201,7 @@ describe "Regex::MatchData" do
203
201
end
204
202
205
203
it " gets a hash of named captures with duplicated name" do
206
- # TODO: replace with regexp literal after next version release
207
- " Crystal" .match(Regex .new " (?<name>Cr)y(?<name>s)" ).not_nil!.named_captures.should eq({" name" => " s" })
204
+ " Crystal" .match(/(?<name>Cr) y(?<name>s) / ).not_nil!.named_captures.should eq({" name" => " s" })
208
205
end
209
206
end
210
207
@@ -252,8 +249,7 @@ describe "Regex::MatchData" do
252
249
end
253
250
254
251
it " converts into a hash with duplicated names" do
255
- # TODO: replace with regexp literal after next version release
256
- " Crystal" .match(Regex .new " (Cr)(?<name>s)?(yst)?(?<name>al)?" ).not_nil!.to_h.should eq({
252
+ " Crystal" .match(/(Cr)(?<name>s) ?(yst) ?(?<name>al) ?/ ).not_nil!.to_h.should eq({
257
253
0 => " Crystal" ,
258
254
1 => " Cr" ,
259
255
" name" => " al" ,
0 commit comments