* test/etc/test_etc.rb (test_getpwuid, test_getgrgid): use

Process.euid and egid instead of Etc.getlogin to identify current
  user which may be different from a login one (e.g., su command).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-09-03 15:02:22 +00:00
Родитель 1f322f83e7
Коммит c309cda903
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Thu Sep 4 00:01:45 2008 Yusuke Endoh <mame@tsg.ne.jp>
* test/etc/test_etc.rb (test_getpwuid, test_getgrgid): use
Process.euid and egid instead of Etc.getlogin to identify current
user which may be different from a login one (e.g., su command).
Wed Sep 3 23:52:47 2008 Yusuke Endoh <mame@tsg.ne.jp>
* test/etc/test_etc.rb: check only typical use of

Просмотреть файл

@ -32,7 +32,7 @@ class TestEtc < Test::Unit::TestCase
Etc.passwd {|s| passwd[s.uid] = s unless passwd[s.uid] }
passwd.values.each do |s|
assert_equal(s, Etc.getpwuid(s.uid))
assert_equal(s, Etc.getpwuid) if Etc.getlogin == s.name
assert_equal(s, Etc.getpwuid) if Process.euid == s.uid
end
end
@ -73,7 +73,7 @@ class TestEtc < Test::Unit::TestCase
end
groups.each do |s|
assert_equal(s, Etc.getgrgid(s.gid))
assert_equal(s, Etc.getgrgid) if Etc.getlogin == s.name
assert_equal(s, Etc.getgrgid) if Process.egid == s.gid
end
end