aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-21 18:08:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-21 18:08:47 +0000
commitd9dd33fc27fc2108e78dd60cc0b37042bd39f5fd (patch)
tree3a6fce7f5f26e2fa76b106aeb470dcb3aa3fbb31 /test/test_time.rb
parent6df2f3d59c0222c3be5623cb03ab05c333d7f2bf (diff)
downloadruby-d9dd33fc27fc2108e78dd60cc0b37042bd39f5fd.tar.gz
* lib/time.rb (Time#rfc2822): pad leading zeros for year.
(Time#httpdate): ditto. (Time#xmlschema): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_time.rb')
-rw-r--r--test/test_time.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb
index 01c86d72e9..24afec1f21 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -45,6 +45,11 @@ class TestTimeExtention < Test::Unit::TestCase # :nodoc:
}
end
+ def test_encode_rfc2822
+ t = Time.utc(1)
+ assert_equal("Mon, 01 Jan 0001 00:00:00 -0000", t.rfc2822)
+ end
+
def test_rfc2616
t = Time.utc(1994, 11, 6, 8, 49, 37)
assert_equal(t, Time.httpdate("Sun, 06 Nov 1994 08:49:37 GMT"))
@@ -69,6 +74,11 @@ class TestTimeExtention < Test::Unit::TestCase # :nodoc:
Time.httpdate('Sunday, 23-Dec-07 11:22:33 GMT'))
end
+ def test_encode_httpdate
+ t = Time.utc(1)
+ assert_equal("Mon, 01 Jan 0001 00:00:00 GMT", t.httpdate)
+ end
+
def test_rfc3339
t = Time.utc(1985, 4, 12, 23, 20, 50, 520000)
s = "1985-04-12T23:20:50.52Z"
@@ -165,6 +175,9 @@ class TestTimeExtention < Test::Unit::TestCase # :nodoc:
assert_equal("1970-01-01T09:00:00.0123456789012345678+09:00", t.xmlschema(19))
assert_equal("1970-01-01T09:00:00.01234567890123456789+09:00", t.xmlschema(20))
+ t = Time.utc(1)
+ assert_equal("0001-01-01T00:00:00Z", t.xmlschema)
+
begin
Time.at(-1)
rescue ArgumentError