зеркало из https://github.com/github/ruby.git
range.c: class name encoding
* range.c (range_bsearch): preserve encoding of class name in an exception message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
225e3b011f
Коммит
6b8b66b401
6
range.c
6
range.c
|
@ -608,9 +608,9 @@ range_bsearch(VALUE range)
|
|||
smaller = cmp < 0; \
|
||||
} \
|
||||
else { \
|
||||
rb_raise(rb_eTypeError, "wrong argument type %s" \
|
||||
" (must be numeric, true, false or nil)", \
|
||||
rb_obj_classname(v)); \
|
||||
rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE \
|
||||
" (must be numeric, true, false or nil)", \
|
||||
rb_obj_class(v)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -378,6 +378,10 @@ class TestRange < Test::Unit::TestCase
|
|||
assert_raise(TypeError) do
|
||||
(1..42).bsearch{ "not ok" }
|
||||
end
|
||||
c = eval("class C\u{309a 26a1 26c4 1f300};self;end")
|
||||
assert_raise_with_message(TypeError, /C\u{309a 26a1 26c4 1f300}/) do
|
||||
(1..42).bsearch {c.new}
|
||||
end
|
||||
assert_equal (1..42).bsearch{}, (1..42).bsearch{false}
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче