diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | numeric.c | 2 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 4 |
3 files changed, 9 insertions, 1 deletions
@@ -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); diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index c4bc9e6637..f4d3dcbdad 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -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 |