* ext/date/date_core.c (Date::(ABBR_)?(MONTH|DAY)NAMES): should be usascii.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2011-06-11 10:36:19 +00:00
Родитель 4dbc9af8af
Коммит a6567f2b99
3 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Sat Jun 11 19:34:51 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c (Date::(ABBR_)?(MONTH|DAY)NAMES): should be usascii.
Sat Jun 11 19:24:33 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c: rewrote doc.

Просмотреть файл

@ -8114,7 +8114,7 @@ mk_ary_of_str(long len, const char *a[])
if (!a[i])
e = Qnil;
else {
e = rb_str_new2(a[i]);
e = rb_usascii_str_new2(a[i]);
rb_obj_freeze(e);
}
rb_ary_push(o, e);

Просмотреть файл

@ -385,6 +385,19 @@ class TestSH < Test::Unit::TestCase
end
def test_enc
Date::MONTHNAMES.each do |s|
assert_equal(Encoding::US_ASCII, s.encoding) if s
end
Date::DAYNAMES.each do |s|
assert_equal(Encoding::US_ASCII, s.encoding) if s
end
Date::ABBR_MONTHNAMES.each do |s|
assert_equal(Encoding::US_ASCII, s.encoding) if s
end
Date::ABBR_DAYNAMES.each do |s|
assert_equal(Encoding::US_ASCII, s.encoding) if s
end
h = Date._strptime('15:43+09:00'.force_encoding('euc-jp'), '%R%z')
assert_equal(Encoding::EUC_JP, h[:zone].encoding)
h = Date._strptime('15:43+09:00'.force_encoding('ascii-8bit'), '%R%z')