From f9c2dcec4eec842a3d35d83644fed4cc892d94dc Mon Sep 17 00:00:00 2001 From: usa Date: Sat, 17 Jan 2004 13:13:42 +0000 Subject: check ArgumentError by Time.at(-1) instead of by test itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/time.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/time.rb') diff --git a/lib/time.rb b/lib/time.rb index db8728402e..6ee32ba3bf 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -400,6 +400,9 @@ if __FILE__ == $0 Time.rfc2822("Mon, 24 Nov 1997 14:22:01 -0800")) begin Time.at(-1) + rescue ArgumentError + # ignore + else assert_equal(Time.utc(1969, 2, 13, 23, 32, 54) + 3 * 3600 + 30 * 60, Time.rfc2822("Thu, 13 Feb 1969 23:32:54 -0330")) assert_equal(Time.utc(1969, 2, 13, 23, 32, 0) + 3 * 3600 + 30 * 60, @@ -409,7 +412,6 @@ if __FILE__ == $0 1969 23:32 -0330 (Newfoundland Time)")) - rescue ArgumentError end assert_equal(Time.utc(1997, 11, 21, 9, 55, 6), Time.rfc2822("21 Nov 97 09:55:06 GMT")) @@ -464,10 +466,13 @@ if __FILE__ == $0 assert_equal(t, Time.iso8601(s)) begin + Time.at(-1) + rescue ArgumentError + # ignore + else t = Time.utc(1937, 1, 1, 11, 40, 27, 870000) s = "1937-01-01T12:00:27.87+00:20" assert_equal(t, Time.iso8601(s)) - rescue ArgumentError end end @@ -523,9 +528,12 @@ if __FILE__ == $0 assert_equal("2001-04-17T19:23:17.1Z", t.xmlschema(1)) begin + Time.at(-1) + rescue ArgumentError + # ignore + else t = Time.utc(1960, 12, 31, 23, 0, 0, 123456) assert_equal("1960-12-31T23:00:00.123456Z", t.xmlschema(6)) - rescue ArgumentError end end -- cgit v1.2.3