summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/uri/test_common.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb
index c213a84c2c..1e1a40d115 100644
--- a/test/uri/test_common.rb
+++ b/test/uri/test_common.rb
@@ -29,6 +29,20 @@ class TestCommon < Test::Unit::TestCase
assert_equal(['From:', 'mailto:xxx@xxx.xxx.xxx]'].sort,
URI.extract('From: XXX [mailto:xxx@xxx.xxx.xxx]').sort)
end
+
+ def test_regexp
+ assert_instance_of Regexp, URI.regexp
+ assert_instance_of Regexp, URI.regexp(['http'])
+ assert_equal URI.regexp, URI.regexp
+ assert_equal 'http://', 'x http:// x'.slice(URI.regexp)
+ assert_equal 'http://', 'x http:// x'.slice(URI.regexp(['http']))
+ assert_equal 'http://', 'x http:// x ftp://'.slice(URI.regexp(['http']))
+ assert_equal nil, 'http://'.slice(URI.regexp([]))
+ assert_equal nil, ''.slice(URI.regexp)
+ assert_equal nil, 'xxxx'.slice(URI.regexp)
+ assert_equal nil, ':'.slice(URI.regexp)
+ assert_equal 'From:', 'From:'.slice(URI.regexp)
+ end
end