diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-08 04:09:02 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-08 04:09:02 +0000 |
commit | c3c0468f33a217ad2540e403c92bf340687f4332 (patch) | |
tree | 6612e7389c84e4eebeabb1ab00d24fa149dfc6e0 /test/uri/test_common.rb | |
parent | 33565505819b313857f55a1f0b6309719e8799b3 (diff) |
* lib/uri/common.rb: new method URI.regexp. [ruby-dev:22121]
* test/uri/test_common.rb: add test for URI.regexp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri/test_common.rb')
-rw-r--r-- | test/uri/test_common.rb | 14 |
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 |