Fix "Relax expectations of errors from getgrnam"

Use `assert_raise_kind_of` instead of `assert_raise`, that rejects sub
classes of the given exceptions.
This commit is contained in:
Nobuyoshi Nakada 2025-01-24 17:05:35 +09:00
parent 4138b187dc
commit 96a5da6786
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-01-24 08:55:39 +00:00

View File

@ -1693,7 +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
exc = assert_raise(ArgumentError, SystemCallError) do
exc = assert_raise_kind_of(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)