test/ruby/test_m17n.rb: Run a test under assert_separately

The test uses `Encoding.default_external = Encoding::UTF_16BE`, which
may add a wrongly UTF_16BE-encoded path to $LOADED_FEATURES (depending
on the order of tests). Unfortunately this breaks another test:

http://ci.rvm.jp/results/trunk-test@ruby-sky1/3711615
```
/tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:11:in `===': incompatible encoding regexp match (US-ASCII regexp with UTF-16BE string) (Encoding::CompatibilityError)
```

According to @naruse-san, we don't pay effort to such a case, so this
change just avoids the issue by running the test in question under
another process.

Co-Authored-By: Koichi Sasada <ko1@atdot.net>
This commit is contained in:
Yusuke Endoh 2021-11-15 14:13:20 +09:00
parent e6bc0acc13
commit a698181021

View file

@ -296,37 +296,35 @@ class TestM17N < Test::Unit::TestCase
end end
def test_object_inspect_external def test_object_inspect_external
orig_v, $VERBOSE = $VERBOSE, false assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
orig_int, Encoding.default_internal = Encoding.default_internal, nil begin;
orig_ext = Encoding.default_external $VERBOSE = false
o = Object.new Encoding.default_internal = nil
o = Object.new
Encoding.default_external = Encoding::UTF_16BE Encoding.default_external = Encoding::UTF_16BE
def o.inspect def o.inspect
"abc" "abc"
end end
assert_nothing_raised(Encoding::CompatibilityError) { [o].inspect } assert_nothing_raised(Encoding::CompatibilityError) { [o].inspect }
def o.inspect def o.inspect
"abc".encode(Encoding.default_external) "abc".encode(Encoding.default_external)
end end
assert_equal '[abc]', [o].inspect assert_equal '[abc]', [o].inspect
Encoding.default_external = Encoding::US_ASCII Encoding.default_external = Encoding::US_ASCII
def o.inspect def o.inspect
"\u3042" "\u3042"
end end
assert_equal '[\u3042]', [o].inspect assert_equal '[\u3042]', [o].inspect
def o.inspect def o.inspect
"\x82\xa0".force_encoding(Encoding::Windows_31J) "\x82\xa0".force_encoding(Encoding::Windows_31J)
end end
assert_equal '[\x{82A0}]', [o].inspect assert_equal '[\x{82A0}]', [o].inspect
ensure end;
Encoding.default_internal = orig_int
Encoding.default_external = orig_ext
$VERBOSE = orig_v
end end
def test_str_dump def test_str_dump