From 04740c0cb015fc0f85691b06e61b76557db06c34 Mon Sep 17 00:00:00 2001 From: kazu Date: Thu, 9 Aug 2018 09:36:03 +0000 Subject: Fix error when Encoding.default_external is Encoding::IBM437 https://ci.appveyor.com/project/ruby/ruby/build/1.0.9151#L4601 ``` 1) Error: TestArgf#test_inplace_nonascii: Encoding::UndefinedConversionError: U+3042 from UTF-8 to IBM437 ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_argf.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index 84397a2d01..a76bdccf45 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -258,12 +258,12 @@ class TestArgf < Test::Unit::TestCase def test_inplace_nonascii ext = Encoding.default_external or skip "no default external encoding" - if ext == Encoding::US_ASCII - skip "external encoding is us-ascii" - end t = nil - ["\u{3042}", "\u{e9}"].any? {|n| t = make_tempfile(n.encode(ext))} or - skip "no name to test" + ["\u{3042}", "\u{e9}"].any? do |n| + t = make_tempfile(n.encode(ext)) + rescue Encoding::UndefinedConversionError + end + t or skip "no name to test" assert_in_out_err(["-i.bak", "-", t.path], "#{<<~"{#"}\n#{<<~'};'}") {# -- cgit v1.2.3