diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index bd63aa0..f747b79 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -52,7 +52,11 @@ class MailTo < Generic HEADER_REGEXP = /\A(?(?:%\h\h|[!$'-.0-;@-Z_a-z~])*=(?:%\h\h|[!$'-.0-;@-Z_a-z~])*)(?:&\g)*\z/ # practical regexp for email address # https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address - EMAIL_REGEXP = /\A(?!\.)(?!.*\.{2})[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+(?(n) {'a@invalid' + longlabel*(n*rate) + endlabel} + assert_linear_performance(1..10, pre: pre) do |to| + re =~ to or flunk + end + endlabel = '.' + 'email'.rjust(64, 'd') + assert_linear_performance(1..10, pre: pre) do |to| + re =~ to and flunk + end + end + def test_to_s u = URI::MailTo.build([nil, 'subject=Ruby'])