зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6d6b33e6e5
Коммит
9759173cfc
|
@ -1,3 +1,9 @@
|
|||
Mon Feb 23 07:25:29 2015 Benoit Daloze <eregontp@gmail.com>
|
||||
|
||||
* 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.
|
||||
|
||||
Sun Feb 22 18:33:42 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||
|
||||
* common.mk: use ruby organization for rubyspec.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
time.c
2
time.c
|
@ -4194,7 +4194,7 @@ time_isdst(VALUE time)
|
|||
static VALUE
|
||||
time_zone_name(const char *zone)
|
||||
{
|
||||
VALUE name = rb_str_new_cstr(zone);
|
||||
VALUE name = rb_usascii_str_new_cstr(zone);
|
||||
if (!rb_enc_str_asciionly_p(name)) {
|
||||
name = rb_external_str_with_enc(name, rb_locale_encoding());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче