summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-24 08:42:52 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-24 08:42:52 +0000
commit5d8bf153429dce73dde8a256580ac1412e469c02 (patch)
tree45c04212e7289321ff7917da81c6070068637c5d /test
parent6d90e595620d1b150aaf7c543ac4d56666d841b3 (diff)
merge revision(s) 49693,46907,49702,49710: [Backport #10887]
* time.c: Zone encoding should be US-ASCII if all 7-bits. Fix r46907. * test/ruby/test_time.rb, test/ruby/test_time_tz.rb: Update tests. * time.c (time_zone_name): should be US-ASCII only if all 7-bits, otherwise locale encoding. [ruby-core:68230] [Bug #10887] * time.c (time_zone_name): should be US-ASCII only if all 7-bits, otherwise locale encoding. [ruby-core:68230] [Bug #10887] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_time.rb9
-rw-r--r--test/ruby/test_time_tz.rb1
2 files changed, 7 insertions, 3 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index d0ded0ddf2..f4fb5bf3b3 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -527,9 +527,12 @@ class TestTime < Test::Unit::TestCase
def assert_zone_encoding(time)
zone = time.zone
assert_predicate(zone, :valid_encoding?)
- return if zone.ascii_only?
- enc = Encoding.default_internal || Encoding.find('locale')
- assert_equal(enc, zone.encoding)
+ if zone.ascii_only?
+ assert_equal(Encoding::US_ASCII, zone.encoding)
+ else
+ enc = Encoding.default_internal || Encoding.find('locale')
+ assert_equal(enc, zone.encoding)
+ end
end
def test_zone
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
index 6f3e05f4cc..fb1ab9b7c8 100644
--- a/test/ruby/test_time_tz.rb
+++ b/test/ruby/test_time_tz.rb
@@ -267,6 +267,7 @@ class TestTimeTZ < Test::Unit::TestCase
assert_equal(format_gmtoff(gmtoff), t.strftime("%z"))
assert_equal(format_gmtoff(gmtoff, true), t.strftime("%:z"))
assert_equal(format_gmtoff2(gmtoff), t.strftime("%::z"))
+ assert_equal(Encoding::US_ASCII, t.zone.encoding)
}
}
}