diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2025-08-15 21:15:45 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-08-15 22:42:07 -0400 |
| commit | 87c4ebd00115b9424f04813b4dd5f3d087a14eb9 (patch) | |
| tree | c5cb35f6bdc1432511dff97c80db03c4a902e177 /test/ruby/test_process.rb | |
| parent | db3d82bcd2f2c7ed41e3c2cb138d2b432b1a224e (diff) | |
Fix tests using assert_raise_with_message on US-ASCII systems
On systems where the Encoding.default_internal defaults to US-ASCII instead
of UTF-8, some tests using assert_raise_with_message can fail since it no
longer changes Encoding.default_internal in 79f5202.
This tests explicitly uses EnvUtil.with_default_internal on systems where
these tests fail.
Diffstat (limited to 'test/ruby/test_process.rb')
| -rw-r--r-- | test/ruby/test_process.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index f1894ab0c3..221ff37c6b 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -114,14 +114,19 @@ class TestProcess < Test::Unit::TestCase } assert_raise(ArgumentError) { Process.getrlimit(:FOO) } assert_raise(ArgumentError) { Process.getrlimit("FOO") } - assert_raise_with_message(ArgumentError, /\u{30eb 30d3 30fc}/) { Process.getrlimit("\u{30eb 30d3 30fc}") } + + EnvUtil.with_default_internal(Encoding::UTF_8) do + assert_raise_with_message(ArgumentError, /\u{30eb 30d3 30fc}/) { Process.getrlimit("\u{30eb 30d3 30fc}") } + end end def test_rlimit_value return unless rlimit_exist? assert_raise(ArgumentError) { Process.setrlimit(:FOO, 0) } assert_raise(ArgumentError) { Process.setrlimit(:CORE, :FOO) } - assert_raise_with_message(ArgumentError, /\u{30eb 30d3 30fc}/) { Process.setrlimit("\u{30eb 30d3 30fc}", 0) } + EnvUtil.with_default_internal(Encoding::UTF_8) do + assert_raise_with_message(ArgumentError, /\u{30eb 30d3 30fc}/) { Process.setrlimit("\u{30eb 30d3 30fc}", 0) } + end assert_raise_with_message(ArgumentError, /\u{30eb 30d3 30fc}/) { Process.setrlimit(:CORE, "\u{30eb 30d3 30fc}") } with_tmpchdir do s = run_in_child(<<-'End') |
