Skip to content

Commit

Permalink
Remove TODO about duplicated named group Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust authored and ysbaddaden committed Jan 22, 2018
1 parent e5da7d3 commit fd55e8d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions spec/std/match_data_spec.cr
Expand Up @@ -49,8 +49,7 @@ describe "Regex::MatchData" do
end

it "captures duplicated named group" do
# TODO: replace with regexp literal after next version release
re = Regex.new "(?:(?<g1>foo)|(?<g1>bar))*"
re = /(?:(?<g1>foo)|(?<g1>bar))*/

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

it "captures duplicated named group" do
# TODO: replace with regexp literal after next version release
re = Regex.new "(?:(?<g1>foo)|(?<g1>bar))*"
re = /(?:(?<g1>foo)|(?<g1>bar))*/

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

it "gets a hash of named captures with duplicated name" do
# TODO: replace with regexp literal after next version release
"Crystal".match(Regex.new "(?<name>Cr)y(?<name>s)").not_nil!.named_captures.should eq({"name" => "s"})
"Crystal".match(/(?<name>Cr)y(?<name>s)/).not_nil!.named_captures.should eq({"name" => "s"})
end
end

Expand Down Expand Up @@ -252,8 +249,7 @@ describe "Regex::MatchData" do
end

it "converts into a hash with duplicated names" do
# TODO: replace with regexp literal after next version release
"Crystal".match(Regex.new "(Cr)(?<name>s)?(yst)?(?<name>al)?").not_nil!.to_h.should eq({
"Crystal".match(/(Cr)(?<name>s)?(yst)?(?<name>al)?/).not_nil!.to_h.should eq({
0 => "Crystal",
1 => "Cr",
"name" => "al",
Expand Down

0 comments on commit fd55e8d

Please sign in to comment.