Skip to content

Commit f8fdbe7

Browse files
committed
Add regression test for regexp issue filed via GitHub
1 parent eb71e5a commit f8fdbe7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

spec/truffle/regressions_spec.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) 2021, 2021 Oracle and/or its affiliates. All rights reserved. This
2+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
3+
# redistribute it and/or modify it under the terms of the:
4+
#
5+
# Eclipse Public License version 2.0, or
6+
# GNU General Public License version 2, or
7+
# GNU Lesser General Public License version 2.1.
8+
9+
require_relative '../ruby/spec_helper'
10+
11+
describe "Regression test suite" do
12+
it "fixes GitHub issue 2204" do
13+
/\A([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?\.rb\z/.match("20190116152522_enable_postgis_extension.rb").to_a.should ==
14+
["20190116152522_enable_postgis_extension.rb", "20190116152522", "enable_postgis_extension", ""]
15+
16+
/\A([0-9]+)_([_a-z0-9]*)\.?([_a-z0-9]*)?\.rb\z/.match("20190116152523_create_schools.rb").to_a.should ==
17+
["20190116152523_create_schools.rb", "20190116152523", "create_schools", ""]
18+
19+
/^0{2}?(00)?(44)?(0)?([1-357-9]\d{9}|[18]\d{8}|8\d{6})$/.match("07123456789").to_a.should ==
20+
["07123456789", nil, nil, "0", "7123456789"]
21+
22+
/^0{2}?(00)?44/.match("447123456789").to_a.should ==
23+
["44", nil]
24+
25+
/^0{2}?(00)?(44)(0)?([1-357-9]\d{9}|[18]\d{8}|8\d{6})$/.match("447123456789").to_a.should ==
26+
["447123456789", nil, "44", nil, "7123456789"]
27+
28+
/^0{2}?(00)?(44)?(0)?([1-357-9]\d{9}|[18]\d{8}|8\d{6})$/.match("07123456789").to_a.should ==
29+
["07123456789", nil, nil, "0", "7123456789"]
30+
31+
/^0{2}?(00)?44/.match("447123456789").to_a.should ==
32+
["44", nil]
33+
34+
/^0{2}?(00)?(44)(0)?([1-357-9]\d{9}|[18]\d{8}|8\d{6})$/.match("447123456789").to_a.should ==
35+
["447123456789", nil, "44", nil, "7123456789"]
36+
end
37+
end

0 commit comments

Comments
 (0)