ruby-changes:60796
From: Nobuyoshi <ko1@a...>
Date: Thu, 16 Apr 2020 23:40:38 +0900 (JST)
Subject: [ruby-changes:60796] 748c7c7c0b (master): Added tests for Process::UID.from_name and Process::GID.from_name
https://git.ruby-lang.org/ruby.git/commit/?id=748c7c7c0b From 748c7c7c0b4ce605c0cedf971e94f0076e0e77de Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 16 Apr 2020 20:36:20 +0900 Subject: Added tests for Process::UID.from_name and Process::GID.from_name diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 7170e82..ccca183 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1605,6 +1605,22 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1605 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) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/