diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-16 20:36:20 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-16 20:50:08 +0900 |
commit | 748c7c7c0b4ce605c0cedf971e94f0076e0e77de (patch) | |
tree | d6be26638f2221e9df84433d07d21622d89a0ded /test/ruby/test_process.rb | |
parent | f57e2d7296fbdf09041bdb237c7423a12ef06621 (diff) |
Added tests for Process::UID.from_name and Process::GID.from_name
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r-- | test/ruby/test_process.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 7170e826d5..ccca1834cf 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1605,6 +1605,22 @@ class TestProcess < Test::Unit::TestCase rescue NotImplementedError end + if Process::UID.respond_to?(:from_name) + def test_uid_from_name + if u = Etc.getpwuid(Process.uid) + assert_equal(Process.uid, Process::UID.from_name(u.name), u.name) + end + end + end + + if Process::GID.respond_to?(:from_name) + def test_gid_from_name + if g = Etc.getgrgid(Process.gid) + assert_equal(Process.gid, Process::GID.from_name(g.name), g.name) + end + end + end + def test_uid_re_exchangeable_p r = Process::UID.re_exchangeable? assert_include([true, false], r) |