* 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:
parent
0347b17b27
commit
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>
|
Sat Jun 11 16:28:25 2011 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rexml/formatters/pretty.rb
|
* lib/rexml/formatters/pretty.rb
|
||||||
|
@ -2118,7 +2118,7 @@ rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
|
|||||||
int n;
|
int n;
|
||||||
VALUE str;
|
VALUE str;
|
||||||
if ((n = rb_enc_codelen(code, enc)) <= 0) {
|
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);
|
str = rb_enc_str_new(0, n, enc);
|
||||||
rb_enc_mbcput(code, RSTRING_PTR(str), 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([b].pack("C"), b.chr)
|
||||||
}
|
}
|
||||||
assert_equal("\x84\x31\xA4\x39".force_encoding("GB18030"), 0x8431A439.chr("GB18030"))
|
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
|
end
|
||||||
|
|
||||||
def test_marshal
|
def test_marshal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user