Skip to content

Commit

Permalink
Fix RegExp warning causing flaky Ripper failure
Browse files Browse the repository at this point in the history
Sometimes this file get picked up and break Ripper tests:

    TestRipper::Generic#test_parse_files:test/ruby
    assert_separately failed with error message
    pid 63392 exit 0
    | test_regexp.rb:2025: warning: character class has duplicated range

https://github.com/ruby/ruby/actions/runs/7699956651/job/20982702553#step:12:103
  • Loading branch information
XrXr committed Jan 29, 2024
1 parent 8e1fe15 commit 676b3c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/ruby/test_regexp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ def test_bug_20207 # [Bug #20207]

def test_bug_20212 # [Bug #20212]
regex = Regexp.new(
/\A((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-zd]+[a-zd-]*[a-zd]+).((?=.*?[a-z])(?!.*--)[a-zd]+[a-zd-]*[a-zd]+)\Z/x
/\A((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z]+[a-z-]*[a-z]+).((?=.*?[a-z])(?!.*--)[a-z]+[a-z-]*[a-z]+)\Z/x
)
string = "www.google.com"
100.times.each { assert(regex.match?(string)) }
Expand Down

0 comments on commit 676b3c9

Please sign in to comment.