ruby-changes:35221
From: nobu <ko1@a...>
Date: Thu, 28 Aug 2014 14:55:25 +0900 (JST)
Subject: [ruby-changes:35221] nobu:r47303 (trunk): io.c: preserve encodings
nobu 2014-08-28 14:55:08 +0900 (Thu, 28 Aug 2014) New Revision: 47303 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47303 Log: io.c: preserve encodings * io.c (advice_arg_check): preserve encodings in warning messages. Modified files: trunk/io.c trunk/test/ruby/test_io.rb Index: io.c =================================================================== --- io.c (revision 47302) +++ io.c (revision 47303) @@ -8558,9 +8558,7 @@ advice_arg_check(VALUE advice) https://github.com/ruby/ruby/blob/trunk/io.c#L8558 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); } } Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 47302) +++ test/ruby/test_io.rb (revision 47303) @@ -2476,10 +2476,10 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2476 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/