2003-10-05 02:09:26 -04:00
|
|
|
require 'test/unit'
|
2003-10-04 00:02:16 -04:00
|
|
|
require 'uri'
|
|
|
|
|
2003-10-05 02:09:26 -04:00
|
|
|
module URI
|
|
|
|
|
|
|
|
|
|
|
|
class TestCommon < Test::Unit::TestCase
|
2003-10-04 00:02:16 -04:00
|
|
|
def setup
|
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_extract
|
|
|
|
# ruby-list:36086
|
|
|
|
assert_equal(['http://example.com'],
|
|
|
|
URI.extract('http://example.com'))
|
|
|
|
assert_equal(['http://example.com'],
|
|
|
|
URI.extract('(http://example.com)'))
|
|
|
|
assert_equal(['http://example.com/foo)'],
|
|
|
|
URI.extract('(http://example.com/foo)'))
|
|
|
|
assert_equal(['http://example.jphttp://example.jp'],
|
|
|
|
URI.extract('http://example.jphttp://example.jp'))
|
|
|
|
assert_equal(['http://example.jphttp://example.jp'],
|
|
|
|
URI.extract('http://example.jphttp://example.jp', ['http']))
|
|
|
|
assert_equal(['http://', 'mailto:'].sort,
|
|
|
|
URI.extract('ftp:// http:// mailto: https://', ['http', 'mailto']).sort)
|
|
|
|
# reported by Doug Kearns <djkea2@mugca.its.monash.edu.au>
|
|
|
|
assert_equal(['From:', 'mailto:xxx@xxx.xxx.xxx]'].sort,
|
|
|
|
URI.extract('From: XXX [mailto:xxx@xxx.xxx.xxx]').sort)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-10-05 02:09:26 -04:00
|
|
|
|
2003-10-04 00:02:16 -04:00
|
|
|
end
|