mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/pp.rb: Use Test::Unit.
* lib/prettyprint.rb: Ditto * lib/time.rb: Ditto * lib/tsort.rb: Ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c2dbfe53fc
commit
fce7467e60
5 changed files with 113 additions and 89 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Jan 21 14:46:12 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
* lib/pp.rb: Use Test::Unit.
|
||||||
|
|
||||||
|
* lib/prettyprint.rb: Ditto
|
||||||
|
|
||||||
|
* lib/time.rb: Ditto
|
||||||
|
|
||||||
|
* lib/tsort.rb: Ditto
|
||||||
|
|
||||||
Tue Jan 21 04:15:50 2003 Tanaka Akira <akr@m17n.org>
|
Tue Jan 21 04:15:50 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/pp.rb: Use redefined `to_s' as well as `inspect'.
|
* lib/pp.rb: Use redefined `to_s' as well as `inspect'.
|
||||||
|
|
43
lib/pp.rb
43
lib/pp.rb
|
@ -423,10 +423,9 @@ end
|
||||||
}
|
}
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
require 'runit/testcase'
|
require 'test/unit'
|
||||||
require 'runit/cui/testrunner'
|
|
||||||
|
|
||||||
class PPTest < RUNIT::TestCase
|
class PPTest < Test::Unit::TestCase
|
||||||
def test_list0123_12
|
def test_list0123_12
|
||||||
assert_equal("[0, 1, 2, 3]\n", PP.pp([0,1,2,3], '', 12))
|
assert_equal("[0, 1, 2, 3]\n", PP.pp([0,1,2,3], '', 12))
|
||||||
end
|
end
|
||||||
|
@ -474,7 +473,15 @@ if __FILE__ == $0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class PPInspectTest < RUNIT::TestCase
|
class PrettyPrintInspect < HasPrettyPrint
|
||||||
|
alias inspect pretty_print_inspect
|
||||||
|
end
|
||||||
|
|
||||||
|
class PrettyPrintInspectWithoutPrettyPrint
|
||||||
|
alias inspect pretty_print_inspect
|
||||||
|
end
|
||||||
|
|
||||||
|
class PPInspectTest < Test::Unit::TestCase
|
||||||
def test_hasinspect
|
def test_hasinspect
|
||||||
a = HasInspect.new(1)
|
a = HasInspect.new(1)
|
||||||
assert_equal("<inspect:1>\n", PP.pp(a, ''))
|
assert_equal("<inspect:1>\n", PP.pp(a, ''))
|
||||||
|
@ -489,9 +496,21 @@ if __FILE__ == $0
|
||||||
a = HasBoth.new(1)
|
a = HasBoth.new(1)
|
||||||
assert_equal("<pretty_print:1>\n", PP.pp(a, ''))
|
assert_equal("<pretty_print:1>\n", PP.pp(a, ''))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pretty_print_inspect
|
||||||
|
a = PrettyPrintInspect.new(1)
|
||||||
|
assert_equal("<pretty_print:1>", a.inspect)
|
||||||
|
a = PrettyPrintInspectWithoutPrettyPrint.new
|
||||||
|
assert_raises(RuntimeError) { a.inspect }
|
||||||
end
|
end
|
||||||
|
|
||||||
class PPCycleTest < RUNIT::TestCase
|
def test_proc
|
||||||
|
a = proc {1}
|
||||||
|
assert_equal("#{a.inspect}\n", PP.pp(a, ''))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class PPCycleTest < Test::Unit::TestCase
|
||||||
def test_array
|
def test_array
|
||||||
a = []
|
a = []
|
||||||
a << a
|
a << a
|
||||||
|
@ -522,9 +541,15 @@ if __FILE__ == $0
|
||||||
a << HasInspect.new(a)
|
a << HasInspect.new(a)
|
||||||
assert_equal("[<inspect:[...]>]\n", PP.pp(a, ''))
|
assert_equal("[<inspect:[...]>]\n", PP.pp(a, ''))
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
RUNIT::CUI::TestRunner.run(PPTest.suite)
|
def test_share_nil
|
||||||
RUNIT::CUI::TestRunner.run(PPInspectTest.suite)
|
begin
|
||||||
RUNIT::CUI::TestRunner.run(PPCycleTest.suite)
|
PP.sharing_detection = true
|
||||||
|
a = [nil, nil]
|
||||||
|
assert_equal("[nil, nil]\n", PP.pp(a, ''))
|
||||||
|
ensure
|
||||||
|
PP.sharing_detection = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -392,10 +392,9 @@ class PrettyPrint
|
||||||
end
|
end
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
require 'runit/testcase'
|
require 'test/unit'
|
||||||
require 'runit/cui/testrunner'
|
|
||||||
|
|
||||||
class WadlerExample < RUNIT::TestCase
|
class WadlerExample < Test::Unit::TestCase
|
||||||
def setup
|
def setup
|
||||||
@tree = Tree.new("aaaa", Tree.new("bbbbb", Tree.new("ccc"),
|
@tree = Tree.new("aaaa", Tree.new("bbbbb", Tree.new("ccc"),
|
||||||
Tree.new("dd")),
|
Tree.new("dd")),
|
||||||
|
@ -632,7 +631,7 @@ End
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class StrictPrettyExample < RUNIT::TestCase
|
class StrictPrettyExample < Test::Unit::TestCase
|
||||||
def prog(width)
|
def prog(width)
|
||||||
PrettyPrint.format('', width) {|pp|
|
PrettyPrint.format('', width) {|pp|
|
||||||
pp.group {
|
pp.group {
|
||||||
|
@ -777,7 +776,7 @@ End
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class TailGroup < RUNIT::TestCase
|
class TailGroup < Test::Unit::TestCase
|
||||||
def test_1
|
def test_1
|
||||||
out = PrettyPrint.format('', 10) {|pp|
|
out = PrettyPrint.format('', 10) {|pp|
|
||||||
pp.group {
|
pp.group {
|
||||||
|
@ -797,7 +796,7 @@ End
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class NonString < RUNIT::TestCase
|
class NonString < Test::Unit::TestCase
|
||||||
def format(width)
|
def format(width)
|
||||||
PrettyPrint.format([], width, 'newline', lambda {|n| "#{n} spaces"}) {|pp|
|
PrettyPrint.format([], width, 'newline', lambda {|n| "#{n} spaces"}) {|pp|
|
||||||
pp.text(3, 3)
|
pp.text(3, 3)
|
||||||
|
@ -816,7 +815,7 @@ End
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Fill < RUNIT::TestCase
|
class Fill < Test::Unit::TestCase
|
||||||
def format(width)
|
def format(width)
|
||||||
PrettyPrint.format('', width) {|pp|
|
PrettyPrint.format('', width) {|pp|
|
||||||
pp.group {
|
pp.group {
|
||||||
|
@ -907,10 +906,4 @@ End
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RUNIT::CUI::TestRunner.run(WadlerExample.suite)
|
|
||||||
RUNIT::CUI::TestRunner.run(StrictPrettyExample.suite)
|
|
||||||
RUNIT::CUI::TestRunner.run(TailGroup.suite)
|
|
||||||
RUNIT::CUI::TestRunner.run(NonString.suite)
|
|
||||||
RUNIT::CUI::TestRunner.run(Fill.suite)
|
|
||||||
end
|
end
|
||||||
|
|
122
lib/time.rb
122
lib/time.rb
|
@ -388,10 +388,9 @@ class Time
|
||||||
end
|
end
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
require 'runit/testcase'
|
require 'test/unit'
|
||||||
require 'runit/cui/testrunner'
|
|
||||||
|
|
||||||
class TimeExtentionTest < RUNIT::TestCase
|
class TimeExtentionTest < Test::Unit::TestCase
|
||||||
def test_rfc822
|
def test_rfc822
|
||||||
assert_equal(Time.utc(1976, 8, 26, 14, 30) + 4 * 3600,
|
assert_equal(Time.utc(1976, 8, 26, 14, 30) + 4 * 3600,
|
||||||
Time.rfc2822("26 Aug 76 14:30 EDT"))
|
Time.rfc2822("26 Aug 76 14:30 EDT"))
|
||||||
|
@ -423,7 +422,7 @@ if __FILE__ == $0
|
||||||
Time.rfc2822("21 Nov 97 09:55:06 GMT"))
|
Time.rfc2822("21 Nov 97 09:55:06 GMT"))
|
||||||
assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600,
|
assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600,
|
||||||
Time.rfc2822("Fri, 21 Nov 1997 09 : 55 : 06 -0600"))
|
Time.rfc2822("Fri, 21 Nov 1997 09 : 55 : 06 -0600"))
|
||||||
assert_exception(ArgumentError) {
|
assert_raises(ArgumentError) {
|
||||||
# inner comment is not supported.
|
# inner comment is not supported.
|
||||||
Time.rfc2822("Fri, 21 Nov 1997 09(comment): 55 : 06 -0600")
|
Time.rfc2822("Fri, 21 Nov 1997 09(comment): 55 : 06 -0600")
|
||||||
}
|
}
|
||||||
|
@ -548,67 +547,66 @@ if __FILE__ == $0
|
||||||
|
|
||||||
def test_invalid
|
def test_invalid
|
||||||
# They were actually used in some web sites.
|
# They were actually used in some web sites.
|
||||||
assert_exception(ArgumentError) { Time.httpdate("1 Dec 2001 10:23:57 GMT") }
|
assert_raises(ArgumentError) { Time.httpdate("1 Dec 2001 10:23:57 GMT") }
|
||||||
assert_exception(ArgumentError) { Time.httpdate("Sat, 1 Dec 2001 10:25:42 GMT") }
|
assert_raises(ArgumentError) { Time.httpdate("Sat, 1 Dec 2001 10:25:42 GMT") }
|
||||||
assert_exception(ArgumentError) { Time.httpdate("Sat, 1-Dec-2001 10:53:55 GMT") }
|
assert_raises(ArgumentError) { Time.httpdate("Sat, 1-Dec-2001 10:53:55 GMT") }
|
||||||
assert_exception(ArgumentError) { Time.httpdate("Saturday, 01-Dec-2001 10:15:34 GMT") }
|
assert_raises(ArgumentError) { Time.httpdate("Saturday, 01-Dec-2001 10:15:34 GMT") }
|
||||||
assert_exception(ArgumentError) { Time.httpdate("Saturday, 01-Dec-101 11:10:07 GMT") }
|
assert_raises(ArgumentError) { Time.httpdate("Saturday, 01-Dec-101 11:10:07 GMT") }
|
||||||
assert_exception(ArgumentError) { Time.httpdate("Fri, 30 Nov 2001 21:30:00 JST") }
|
assert_raises(ArgumentError) { Time.httpdate("Fri, 30 Nov 2001 21:30:00 JST") }
|
||||||
|
|
||||||
# They were actually used in some mails.
|
# They were actually used in some mails.
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("01-5-20") }
|
assert_raises(ArgumentError) { Time.rfc2822("01-5-20") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("7/21/00") }
|
assert_raises(ArgumentError) { Time.rfc2822("7/21/00") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("2001-8-28") }
|
assert_raises(ArgumentError) { Time.rfc2822("2001-8-28") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("00-5-6 1:13:06") }
|
assert_raises(ArgumentError) { Time.rfc2822("00-5-6 1:13:06") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("2001-9-27 9:36:49") }
|
assert_raises(ArgumentError) { Time.rfc2822("2001-9-27 9:36:49") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("2000-12-13 11:01:11") }
|
assert_raises(ArgumentError) { Time.rfc2822("2000-12-13 11:01:11") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("2001/10/17 04:29:55") }
|
assert_raises(ArgumentError) { Time.rfc2822("2001/10/17 04:29:55") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("9/4/2001 9:23:19 PM") }
|
assert_raises(ArgumentError) { Time.rfc2822("9/4/2001 9:23:19 PM") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("01 Nov 2001 09:04:31") }
|
assert_raises(ArgumentError) { Time.rfc2822("01 Nov 2001 09:04:31") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("13 Feb 2001 16:4 GMT") }
|
assert_raises(ArgumentError) { Time.rfc2822("13 Feb 2001 16:4 GMT") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("01 Oct 00 5:41:19 PM") }
|
assert_raises(ArgumentError) { Time.rfc2822("01 Oct 00 5:41:19 PM") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("2 Jul 00 00:51:37 JST") }
|
assert_raises(ArgumentError) { Time.rfc2822("2 Jul 00 00:51:37 JST") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("01 11 2001 06:55:57 -0500") }
|
assert_raises(ArgumentError) { Time.rfc2822("01 11 2001 06:55:57 -0500") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("18 \343\366\356\341\370 2000") }
|
assert_raises(ArgumentError) { Time.rfc2822("18 \343\366\356\341\370 2000") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, Oct 2001 18:53:32") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, Oct 2001 18:53:32") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 2 Nov 2001 03:47:54") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 2 Nov 2001 03:47:54") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 27 Jul 2001 11.14.14 +0200") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 27 Jul 2001 11.14.14 +0200") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Thu, 2 Nov 2000 04:13:53 -600") }
|
assert_raises(ArgumentError) { Time.rfc2822("Thu, 2 Nov 2000 04:13:53 -600") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wed, 5 Apr 2000 22:57:09 JST") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wed, 5 Apr 2000 22:57:09 JST") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Mon, 11 Sep 2000 19:47:33 00000") }
|
assert_raises(ArgumentError) { Time.rfc2822("Mon, 11 Sep 2000 19:47:33 00000") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 28 Apr 2000 20:40:47 +-900") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 28 Apr 2000 20:40:47 +-900") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 19 Jan 2001 8:15:36 AM -0500") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 19 Jan 2001 8:15:36 AM -0500") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Thursday, Sep 27 2001 7:42:35 AM EST") }
|
assert_raises(ArgumentError) { Time.rfc2822("Thursday, Sep 27 2001 7:42:35 AM EST") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("3/11/2001 1:31:57 PM Pacific Daylight Time") }
|
assert_raises(ArgumentError) { Time.rfc2822("3/11/2001 1:31:57 PM Pacific Daylight Time") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Mi, 28 Mrz 2001 11:51:36") }
|
assert_raises(ArgumentError) { Time.rfc2822("Mi, 28 Mrz 2001 11:51:36") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("P, 30 sept 2001 23:03:14") }
|
assert_raises(ArgumentError) { Time.rfc2822("P, 30 sept 2001 23:03:14") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("fr, 11 aug 2000 18:39:22") }
|
assert_raises(ArgumentError) { Time.rfc2822("fr, 11 aug 2000 18:39:22") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fr, 21 Sep 2001 17:44:03 -1000") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fr, 21 Sep 2001 17:44:03 -1000") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Mo, 18 Jun 2001 19:21:40 -1000") }
|
assert_raises(ArgumentError) { Time.rfc2822("Mo, 18 Jun 2001 19:21:40 -1000") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("l\366, 12 aug 2000 18:53:20") }
|
assert_raises(ArgumentError) { Time.rfc2822("l\366, 12 aug 2000 18:53:20") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("l\366, 26 maj 2001 00:15:58") }
|
assert_raises(ArgumentError) { Time.rfc2822("l\366, 26 maj 2001 00:15:58") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Dom, 30 Sep 2001 17:36:30") }
|
assert_raises(ArgumentError) { Time.rfc2822("Dom, 30 Sep 2001 17:36:30") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("%&, 31 %2/ 2000 15:44:47 -0500") }
|
assert_raises(ArgumentError) { Time.rfc2822("%&, 31 %2/ 2000 15:44:47 -0500") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("dom, 26 ago 2001 03:57:07 -0300") }
|
assert_raises(ArgumentError) { Time.rfc2822("dom, 26 ago 2001 03:57:07 -0300") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("ter, 04 set 2001 16:27:58 -0300") }
|
assert_raises(ArgumentError) { Time.rfc2822("ter, 04 set 2001 16:27:58 -0300") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wen, 3 oct 2001 23:17:49 -0400") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wen, 3 oct 2001 23:17:49 -0400") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wen, 3 oct 2001 23:17:49 -0400") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wen, 3 oct 2001 23:17:49 -0400") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("ele, 11 h: 2000 12:42:15 -0500") }
|
assert_raises(ArgumentError) { Time.rfc2822("ele, 11 h: 2000 12:42:15 -0500") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Tue, 14 Aug 2001 3:55:3 +0200") }
|
assert_raises(ArgumentError) { Time.rfc2822("Tue, 14 Aug 2001 3:55:3 +0200") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 25 Aug 2000 9:3:48 +0800") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 25 Aug 2000 9:3:48 +0800") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 1 Dec 2000 0:57:50 EST") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 1 Dec 2000 0:57:50 EST") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Mon, 7 May 2001 9:39:51 +0200") }
|
assert_raises(ArgumentError) { Time.rfc2822("Mon, 7 May 2001 9:39:51 +0200") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wed, 1 Aug 2001 16:9:15 +0200") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wed, 1 Aug 2001 16:9:15 +0200") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wed, 23 Aug 2000 9:17:36 +0800") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wed, 23 Aug 2000 9:17:36 +0800") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Fri, 11 Aug 2000 10:4:42 +0800") }
|
assert_raises(ArgumentError) { Time.rfc2822("Fri, 11 Aug 2000 10:4:42 +0800") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Sat, 15 Sep 2001 13:22:2 +0300") }
|
assert_raises(ArgumentError) { Time.rfc2822("Sat, 15 Sep 2001 13:22:2 +0300") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wed,16 \276\305\324\302 2001 20:06:25 +0800") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wed,16 \276\305\324\302 2001 20:06:25 +0800") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("Wed,7 \312\256\322\273\324\302 2001 23:47:22 +0800") }
|
assert_raises(ArgumentError) { Time.rfc2822("Wed,7 \312\256\322\273\324\302 2001 23:47:22 +0800") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=C5=DA),?= 10 2 2001 23:32:26 +0900 (JST)") }
|
assert_raises(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=C5=DA),?= 10 2 2001 23:32:26 +0900 (JST)") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("\307\341\314\343\332\311, 30 \344\346\335\343\310\321 2001 10:01:06") }
|
assert_raises(ArgumentError) { Time.rfc2822("\307\341\314\343\332\311, 30 \344\346\335\343\310\321 2001 10:01:06") }
|
||||||
assert_exception(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=BF=E5),?= 12 =?iso-8859-1?Q?9=B7=EE?= 2001 14:52:41\n+0900 (JST)") }
|
assert_raises(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=BF=E5),?= 12 =?iso-8859-1?Q?9=B7=EE?= 2001 14:52:41\n+0900 (JST)") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RUNIT::CUI::TestRunner.run(TimeExtentionTest.suite)
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -245,8 +245,7 @@ module TSort
|
||||||
end
|
end
|
||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
require 'runit/testcase'
|
require 'test/unit'
|
||||||
require 'runit/cui/testrunner'
|
|
||||||
|
|
||||||
class Hash
|
class Hash
|
||||||
include TSort
|
include TSort
|
||||||
|
@ -264,7 +263,7 @@ if __FILE__ == $0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TSortTest < RUNIT::TestCase
|
class TSortTest < Test::Unit::TestCase
|
||||||
def test_dag
|
def test_dag
|
||||||
h = {1=>[2, 3], 2=>[3], 3=>[]}
|
h = {1=>[2, 3], 2=>[3], 3=>[]}
|
||||||
assert_equal([3, 2, 1], h.tsort)
|
assert_equal([3, 2, 1], h.tsort)
|
||||||
|
@ -275,7 +274,7 @@ if __FILE__ == $0
|
||||||
h = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
h = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
||||||
assert_equal([[4], [2, 3], [1]],
|
assert_equal([[4], [2, 3], [1]],
|
||||||
h.strongly_connected_components.map {|nodes| nodes.sort})
|
h.strongly_connected_components.map {|nodes| nodes.sort})
|
||||||
assert_exception(TSort::Cyclic) { h.tsort }
|
assert_raises(TSort::Cyclic) { h.tsort }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_array
|
def test_array
|
||||||
|
@ -289,6 +288,5 @@ if __FILE__ == $0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RUNIT::CUI::TestRunner.run(TSortTest.suite)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue