From 33ceea5cdbed60cdc2108b456c739808f3d58179 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 12 Mar 2012 10:23:17 +0000 Subject: * encoding.c (rb_find_encoding): new function find encoding from arbitrary object as a pointer to rb_encoding, and return NULL if not found. * io.c (io_encoding_set): just warn unsupported encodings, but not exception. [ruby-core:40726] [Bug #5567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby/test_io_m17n.rb') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index d8916433ad..eccc27ac97 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -1060,6 +1060,17 @@ EOT } end + def test_set_encoding_unsupported + bug5567 = '[ruby-core:40726]' + IO.pipe do |r, w| + assert_nothing_raised(bug5567) do + assert_warn(/Unsupported/, bug5567) {r.set_encoding("fffffffffffxx")} + assert_warn(/Unsupported/, bug5567) {r.set_encoding("fffffffffffxx", "us-ascii")} + assert_warn(/Unsupported/, bug5567) {r.set_encoding("us-ascii", "fffffffffffxx")} + end + end + end + def test_textmode_twice assert_raise(ArgumentError) { open(__FILE__, "rt", textmode: true) {|f| -- cgit v1.2.3