* io.c (advice_arg_check): preserve encodings in warning messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-08-28 05:55:08 +00:00
Родитель 20da239464
Коммит cdacaa0a29
2 изменённых файлов: 3 добавлений и 5 удалений

4
io.c
Просмотреть файл

@ -8558,9 +8558,7 @@ advice_arg_check(VALUE advice)
advice != sym_willneed && advice != sym_willneed &&
advice != sym_dontneed && advice != sym_dontneed &&
advice != sym_noreuse) { advice != sym_noreuse) {
VALUE symname = rb_inspect(advice); rb_raise(rb_eNotImpError, "Unsupported advice: %+"PRIsVALUE, advice);
rb_raise(rb_eNotImpError, "Unsupported advice: %s",
StringValuePtr(symname));
} }
} }

Просмотреть файл

@ -2476,10 +2476,10 @@ End
def test_invalid_advise def test_invalid_advise
feature4204 = '[ruby-dev:42887]' feature4204 = '[ruby-dev:42887]'
make_tempfile {|tf| make_tempfile {|tf|
%w{Normal rand glark will_need zzzzzzzzzzzz \u2609}.map(&:to_sym).each do |adv| %W{Normal rand glark will_need zzzzzzzzzzzz \u2609}.map(&:to_sym).each do |adv|
[[0,0], [0, 20], [400, 2]].each do |offset, len| [[0,0], [0, 20], [400, 2]].each do |offset, len|
open(tf.path) do |t| open(tf.path) do |t|
assert_raise(NotImplementedError, feature4204) { t.advise(adv, offset, len) } assert_raise_with_message(NotImplementedError, /#{adv.inspect}/, feature4204) { t.advise(adv, offset, len) }
end end
end end
end end