aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--io.c4
-rw-r--r--test/ruby/test_io.rb4
2 files changed, 3 insertions, 5 deletions
diff --git a/io.c b/io.c
index 7dc1c8956c..ddd9f1a9ff 100644
--- a/io.c
+++ b/io.c
@@ -8558,9 +8558,7 @@ advice_arg_check(VALUE advice)
advice != sym_willneed &&
advice != sym_dontneed &&
advice != sym_noreuse) {
- VALUE symname = rb_inspect(advice);
- rb_raise(rb_eNotImpError, "Unsupported advice: %s",
- StringValuePtr(symname));
+ rb_raise(rb_eNotImpError, "Unsupported advice: %+"PRIsVALUE, advice);
}
}
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 08f39c3a4a..f056c760a8 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2476,10 +2476,10 @@ End
def test_invalid_advise
feature4204 = '[ruby-dev:42887]'
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|
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