зеркало из https://github.com/github/ruby.git
* numeric.c (rb_enc_uint_chr): fix message format. Bug#4869
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0347b17b27
Коммит
6f58118e4c
|
@ -1,3 +1,7 @@
|
|||
Sat Jun 11 16:52:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* numeric.c (rb_enc_uint_chr): fix message format. Bug#4869
|
||||
|
||||
Sat Jun 11 16:28:25 2011 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rexml/formatters/pretty.rb
|
||||
|
|
|
@ -2118,7 +2118,7 @@ rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
|
|||
int n;
|
||||
VALUE str;
|
||||
if ((n = rb_enc_codelen(code, enc)) <= 0) {
|
||||
rb_raise(rb_eRangeError, "%d out of char range", code);
|
||||
rb_raise(rb_eRangeError, "%u out of char range", code);
|
||||
}
|
||||
str = rb_enc_str_new(0, n, enc);
|
||||
rb_enc_mbcput(code, RSTRING_PTR(str), enc);
|
||||
|
|
|
@ -1192,6 +1192,10 @@ class TestM17N < Test::Unit::TestCase
|
|||
assert_equal([b].pack("C"), b.chr)
|
||||
}
|
||||
assert_equal("\x84\x31\xA4\x39".force_encoding("GB18030"), 0x8431A439.chr("GB18030"))
|
||||
e = assert_raise(RangeError) {
|
||||
2206368128.chr(Encoding::UTF_8)
|
||||
}
|
||||
assert_not_match(/-\d+ out of char range/, e.message)
|
||||
end
|
||||
|
||||
def test_marshal
|
||||
|
|
Загрузка…
Ссылка в новой задаче