diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-23 07:20:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-23 07:20:38 +0000 |
commit | 87c8901d6915ecdb6d2807d770c13aa41719e875 (patch) | |
tree | 4d7536347ee46bc11c3e5be72867135cfce5c067 /test/ruby/test_time.rb | |
parent | 98a2dfe7f62567ecf6fcda0622172e5731701c01 (diff) |
test_time.rb: encoding of Time#zone
* test/ruby/test_time.rb (assert_zone_encoding): encoding of
Time#zone is not locale, but the default internal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_time.rb')
-rw-r--r-- | test/ruby/test_time.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index cdce37f796..4ed899baf6 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -517,8 +517,15 @@ class TestTime < Test::Unit::TestCase assert_equal(Time.at(946684800).getlocal.to_s, Time.at(946684800).to_s) end + def assert_zone_encoding(time) + zone = time.zone + assert_predicate(zone, :valid_encoding?) + enc = Encoding.default_internal || Encoding.find('locale') + assert_equal(enc, zone.encoding) + end + def test_zone - assert_equal(Encoding.find('locale'), Time.now.zone.encoding) + assert_zone_encoding Time.now end def test_plus_minus_succ @@ -567,7 +574,7 @@ class TestTime < Test::Unit::TestCase assert_equal(1, t2000.yday) assert_equal(false, t2000.isdst) assert_equal("UTC", t2000.zone) - assert_equal(Encoding.find("locale"), t2000.zone.encoding) + assert_zone_encoding(t2000) assert_equal(0, t2000.gmt_offset) assert_not_predicate(t2000, :sunday?) assert_not_predicate(t2000, :monday?) @@ -589,7 +596,7 @@ class TestTime < Test::Unit::TestCase assert_equal(t.yday, Time.at(946684800).yday) assert_equal(t.isdst, Time.at(946684800).isdst) assert_equal(t.zone, Time.at(946684800).zone) - assert_equal(Encoding.find("locale"), Time.at(946684800).zone.encoding) + assert_zone_encoding(Time.at(946684800)) assert_equal(t.gmt_offset, Time.at(946684800).gmt_offset) assert_equal(t.sunday?, Time.at(946684800).sunday?) assert_equal(t.monday?, Time.at(946684800).monday?) |