Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa49e5b

Browse files
committed
Repeat matching to reduce deviations
1 parent be35e0b commit fa49e5b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/uri/test_mailto.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,18 @@ def test_check_to
213213
def test_email_regexp
214214
re = URI::MailTo::EMAIL_REGEXP
215215

216+
repeat = 10
216217
longlabel = '.' + 'invalid'.ljust(63, 'd')
217218
endlabel = ''
218-
seq = (1..5).map {|i| 5**i}
219-
rehearsal = 100
219+
seq = (1..3).map {|i| 10**i}
220+
rehearsal = 10
220221
pre = ->(n) {'a@invalid' + longlabel*(n) + endlabel}
221222
assert_linear_performance(seq, rehearsal: rehearsal, pre: pre) do |to|
222-
re =~ to or flunk
223+
repeat.times {re =~ to or flunk}
223224
end
224225
endlabel = '.' + 'email'.rjust(64, 'd')
225226
assert_linear_performance(seq, rehearsal: rehearsal, pre: pre) do |to|
226-
re =~ to and flunk
227+
repeat.times {re =~ to and flunk}
227228
end
228229
end
229230

0 commit comments

Comments
 (0)