mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
3356550581
commit
c3c0468f33
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue