diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-11 07:52:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-11 07:52:34 +0000 |
commit | 6f58118e4c6b688aa8c78b5310c4e2c12c444537 (patch) | |
tree | 57f99bc9fb80b46674096e8c280abc9dd786df9c | |
parent | 0347b17b27af6ed50e270e52539424748f1cceac (diff) |
* 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
-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 |