diff options
author | akira <akira@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-04 04:02:16 +0000 |
---|---|---|
committer | akira <akira@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-04 04:02:16 +0000 |
commit | ef5883c016d02059beff0f7c5711e54a35318b32 (patch) | |
tree | 0917473376a6608a91af0361e0c15a25c8ad10c2 /test/uri/test_common.rb | |
parent | d6f70951dbf2dcdec6515ee783de539d739875dd (diff) | |
download | ruby-ef5883c016d02059beff0f7c5711e54a35318b32.tar.gz |
* test/uri/* (6 files): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri/test_common.rb')
-rw-r--r-- | test/uri/test_common.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb new file mode 100644 index 0000000000..b93a71f553 --- /dev/null +++ b/test/uri/test_common.rb @@ -0,0 +1,49 @@ +# +# $Id$ +# +# Copyright (c) 2002 akira yamada <akira@ruby-lang.org> +# You can redistribute it and/or modify it under the same term as Ruby. +# + +require 'runit/testcase' +require 'runit/cui/testrunner' +require 'uri' + +class TestCommon < RUNIT::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 <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 + +if $0 == __FILE__ + if ARGV.size == 0 + suite = TestCommon.suite + else + suite = RUNIT::TestSuite.new + ARGV.each do |testmethod| + suite.add_test(TestGeneric.new(testmethod)) + end + end + RUNIT::CUI::TestRunner.run(suite) +end |