Skip to content

Commit

Permalink
Relax expectations of errors from getgrnam
Browse files Browse the repository at this point in the history
The list of errors cited in 58bc976
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.
  • Loading branch information
nobu committed Jan 22, 2025
1 parent 9f78c72 commit 7070b1b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions test/ruby/test_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1693,12 +1693,7 @@ def test_gid_from_name
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)
Expand Down

0 comments on commit 7070b1b

Please sign in to comment.