From ffa153f282b8fb94734a3b33ba83cc8566a0231f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 28 Aug 2014 05:55:22 +0000 Subject: io.c: preserve encodings * io.c (rb_io_extract_encoding_option): preserve encodings in warning messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index e9e6a1cf83..7f54762ebe 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -312,6 +312,17 @@ EOT } end + def test_ignored_encoding_option + enc = "\u{30a8 30f3 30b3 30fc 30c7 30a3 30f3 30b0}" + pattern = /#{enc}/ + assert_warning(pattern) { + open(IO::NULL, external_encoding: "us-ascii", encoding: enc) + } + assert_warning(pattern) { + open(IO::NULL, internal_encoding: "us-ascii", encoding: enc) + } + end + def test_io_new_enc with_tmpdir { generate_file("tmp", "\xa1") -- cgit v1.2.3