blob: c213a84c2cdf2bfefed081fd4714832dd6734f1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
require 'test/unit'
require 'uri'
module URI
class TestCommon < Test::Unit::TestCase
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 <[email protected]>
assert_equal(['From:', 'mailto:[email protected]]'].sort,
URI.extract('From: XXX [mailto:[email protected]]').sort)
end
end
end
|