1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
def test_object_inspect_external
orig_v, $VERBOSE = $VERBOSE, false
orig_int, Encoding.default_internal = Encoding.default_internal, nil
orig_ext = Encoding.default_external
o = Object.new
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
$VERBOSE = false
Encoding.default_internal = nil
o = Object.new
Encoding.default_external = Encoding::UTF_16BE
def o.inspect
"abc"
end
assert_nothing_raised(Encoding::CompatibilityError) { [o].inspect }
Encoding.default_external = Encoding::UTF_16BE
def o.inspect
"abc"
end
assert_nothing_raised(Encoding::CompatibilityError) { [o].inspect }
def o.inspect
"abc".encode(Encoding.default_external)
end
def o.inspect
"abc".encode(Encoding.default_external)
end
assert_equal '[abc]', [o].inspect
assert_equal '[abc]', [o].inspect
Encoding.default_external = Encoding::US_ASCII
def o.inspect
"\u3042"
end
assert_equal '[\u3042]', [o].inspect
Encoding.default_external = Encoding::US_ASCII
def o.inspect
"\u3042"
end
assert_equal '[\u3042]', [o].inspect
def o.inspect
"\x82\xa0".force_encoding(Encoding::Windows_31J)
end
assert_equal '[\x{82A0}]', [o].inspect
ensure
Encoding.default_internal = orig_int
Encoding.default_external = orig_ext
$VERBOSE = orig_v
def o.inspect
"\x82\xa0".force_encoding(Encoding::Windows_31J)
end
assert_equal '[\x{82A0}]', [o].inspect
end;
end
def test_str_dump