Subject: | locale independent APINet/t/test.t |
Attached patch fixes Win32::APINet make test, on non-english Windows systems.
When the "Administrators" and "Guest" groups are named differrently.
The patch uses the first and third group from LocalGroupEnum, which is about the same.
--- perl-libwin32-0.191/APINet/t/test.t.orig 2002-07-09 02:15:52.000000000 +0100
+++ perl-libwin32-0.191/APINet/t/test.t 2005-02-06 17:26:52.054251400 +0100
@@ -8,6 +8,7 @@
BEGIN { $| = 1; print "1..18\n"; }
END {print "not ok 1\n" unless $loaded;}
+use Win32;
use Win32API::Net qw/ :ALL /;
$loaded = 1;
print "ok 1\n";
@@ -114,26 +115,33 @@
print "not " unless UserEnum($dc, \@users, FILTER_NORMAL_ACCOUNT());
print "ok 10\n";
-print "not " unless LocalGroupGetInfo($dc, "Administrators", 1,
- \%localGroupInfo);
+print "not " unless LocalGroupEnum("", \@localGroups);
print "ok 11\n";
+# pick out out the administrator and guest group names for further tests
+$Administrators = $localGroups[0];
+$Guest = $localGroups[2];
+
+print "not " unless LocalGroupGetInfo($dc, $Administrators, 1,
+ \%localGroupInfo);
+print "ok 12\n";
undef %localGroupInfo;
# LocalGroupAdd()
$localGroupName="##Freds";
+if (grep /^##Freds$/,@localGroups) {
+ $localGroupName = $localGroups[1] . $localGroupName;
+}
+undef @localGroups;
%localGroup=('name' => $localGroupName, 'comment' => 'All the freds');
print "not " unless LocalGroupAdd("", 1, \%localGroup, $fie);
-print "ok 12\n";
+print "ok 13\n";
-@localGroupMembers=($testUserName, "Guest");
+# This will work only for english Windows
+@localGroupMembers=($testUserName, $Guest);
print "not " unless LocalGroupAddMembers("", $localGroupName,
\@localGroupMembers);
-print "ok 13\n";
-
-print "not " unless LocalGroupEnum("", \@localGroups);
print "ok 14\n";
-undef @localGroups;
print "not " unless LocalGroupGetInfo("", $localGroupName, 1, \%lgInfo);
print "ok 15\n";
@@ -142,7 +150,7 @@
print "ok 16\n";
undef %lgMembers;
-@localGroupDelMembers=("Guest");
+@localGroupDelMembers=($Guest);
print "not " unless LocalGroupDelMembers("", $localGroupName,
\@localGroupDelMembers);
print "ok 17\n";