* strftime.c (rb_strftime_with_timespec): %G produces 4 digits.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-01-30 07:10:55 +00:00
parent b4be48e88d
commit 2418e5ca83
3 changed files with 23 additions and 1 deletions

View file

@ -590,6 +590,18 @@ class TestTime < Test::Unit::TestCase
assert_equal("02", t.strftime("%0l"))
assert_equal(" 2", t.strftime("%_l"))
t = Time.utc(1,1,4)
assert_equal("0001", t.strftime("%Y"))
assert_equal("0001", t.strftime("%G"))
t = Time.utc(0,1,4)
assert_equal("0000", t.strftime("%Y"))
assert_equal("0000", t.strftime("%G"))
t = Time.utc(-1,1,4)
assert_equal("-0001", t.strftime("%Y"))
assert_equal("-0001", t.strftime("%G"))
# [ruby-dev:37155]
t = Time.mktime(1970, 1, 18)
assert_equal("0", t.strftime("%w"))