From 9519f6193a940a736036ff0fe03d45b81d1dc4e8 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 23 Nov 2014 17:03:08 +0000 Subject: io.c: preserve encodings * io.c (must_respond_to): preserve encodings of variable name and class name in warning message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 39f357a6b9..02381b132c 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2268,6 +2268,14 @@ End assert_raise(TypeError) { $> = Object.new } assert_in_out_err([], "$> = $stderr\nputs 'foo'", [], %w(foo)) + + assert_separately(%w[-Eutf-8], <<-"end;") # do + alias $\u{6a19 6e96 51fa 529b} $stdout + x = eval("class X\u{307b 3052}; self; end".encode("euc-jp")) + assert_raise_with_message(TypeError, /\\$\u{6a19 6e96 51fa 529b} must.*, X\u{307b 3052} given/) do + $\u{6a19 6e96 51fa 529b} = x.new + end + end; end def test_initialize -- cgit v1.2.3