Skip to content

Commit fd55e8d

Browse files
makenowjustysbaddaden
authored andcommittedJan 22, 2018
Remove TODO about duplicated named group Regex
1 parent e5da7d3 commit fd55e8d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed
 

‎spec/std/match_data_spec.cr

+4-8
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ describe "Regex::MatchData" do
4949
end
5050

5151
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))*/
5453

5554
("foo" =~ re).should eq(0)
5655
$~["g1"].should eq("foo")
@@ -116,8 +115,7 @@ describe "Regex::MatchData" do
116115
end
117116

118117
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))*/
121119

122120
("foo" =~ re).should eq(0)
123121
$~["g1"]?.should eq("foo")
@@ -203,8 +201,7 @@ describe "Regex::MatchData" do
203201
end
204202

205203
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"})
208205
end
209206
end
210207

@@ -252,8 +249,7 @@ describe "Regex::MatchData" do
252249
end
253250

254251
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({
257253
0 => "Crystal",
258254
1 => "Cr",
259255
"name" => "al",

0 commit comments

Comments
 (0)
Please sign in to comment.