aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-06 18:08:31 +0900
committerGitHub <noreply@github.com>2022-07-06 18:08:31 +0900
commit5ef3c7ea2d1968c87f361b6615699b92cc6e5a9a (patch)
tree329847a540de76e070642a7d1d0075fdf9b3e5cb /test/ruby/test_io_m17n.rb
parent53afacd0365b9bc6cd40f83149c5e4fea76a9932 (diff)
downloadruby-5ef3c7ea2d1968c87f361b6615699b92cc6e5a9a.tar.gz
[Bug #18898] Fallback invalid external encoding to the default
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 27b16a2a36..9c14087eba 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -1142,8 +1142,18 @@ EOT
IO.pipe do |r, w|
assert_nothing_raised(bug5567) do
assert_warning(/Unsupported/, bug5567) {r.set_encoding("fffffffffffxx")}
+ w.puts("foo")
+ assert_equal("foo\n", r.gets)
assert_warning(/Unsupported/, bug5567) {r.set_encoding("fffffffffffxx", "us-ascii")}
+ w.puts("bar")
+ assert_equal("bar\n", r.gets)
assert_warning(/Unsupported/, bug5567) {r.set_encoding("us-ascii", "fffffffffffxx")}
+ w.puts("zot")
+ begin
+ assert_equal("zot\n", r.gets)
+ rescue Encoding::ConverterNotFoundError => e
+ assert_match(/\((\S+) to \1\)/, e.message)
+ end
end
end
end