diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-01-22 18:19:54 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-01-22 18:19:54 +0900 |
commit | 7070b1b1968f31f999636b42a1af872458cd5a81 (patch) | |
tree | 39dde201f5de57cf584220f2588a8f2b2e1cf3b3 | |
parent | 9f78c727eab888288875c423effa18c0c808dbfc (diff) |
Relax expectations of errors from `getgrnam`
The list of errors cited in 58bc97628c14933b73f13e0856d1a56e70e8b0e4
is not exhaustive and other errors may be raised by `getgrnam`.
Additionally, these errors are system dependent and may not be listed
on all platforms.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12610
-rw-r--r-- | test/ruby/test_process.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index e0a86b75b1..e901359774 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1693,12 +1693,7 @@ class TestProcess < Test::Unit::TestCase if g = Etc.getgrgid(Process.gid) assert_equal(Process.gid, Process::GID.from_name(g.name), g.name) end - expected_excs = [ArgumentError] - expected_excs << Errno::ENOENT if defined?(Errno::ENOENT) - expected_excs << Errno::ESRCH if defined?(Errno::ESRCH) # WSL 2 actually raises Errno::ESRCH - expected_excs << Errno::EBADF if defined?(Errno::EBADF) - expected_excs << Errno::EPERM if defined?(Errno::EPERM) - exc = assert_raise(*expected_excs) do + exc = assert_raise(ArgumentError, SystemCallError) do Process::GID.from_name("\u{4e0d 5b58 5728}") # fu son zai ("absent" in Kanji) end assert_match(/\u{4e0d 5b58 5728}/, exc.message) if exc.is_a?(ArgumentError) |