Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/uri/test_mailto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,18 @@ def test_check_to
def test_email_regexp
re = URI::MailTo::EMAIL_REGEXP

rate = 1000
repeat = 10
longlabel = '.' + 'invalid'.ljust(63, 'd')
endlabel = ''
pre = ->(n) {'a@invalid' + longlabel*(n*rate) + endlabel}
assert_linear_performance(1..10, pre: pre) do |to|
re =~ to or flunk
seq = (1..3).map {|i| 10**i}
rehearsal = 10
pre = ->(n) {'a@invalid' + longlabel*(n) + endlabel}
assert_linear_performance(seq, rehearsal: rehearsal, pre: pre) do |to|
repeat.times {re =~ to or flunk}
end
endlabel = '.' + 'email'.rjust(64, 'd')
assert_linear_performance(1..10, pre: pre) do |to|
re =~ to and flunk
assert_linear_performance(seq, rehearsal: rehearsal, pre: pre) do |to|
repeat.times {re =~ to and flunk}
end
end

Expand Down
Loading