There can be multiple yacc/bison errors.
[p5sagit/p5-mst-13.2.git] / t / op / groups.t
1 #!./perl
2
3 $ENV{PATH} = '/bin:/usr/bin:/usr/ucb:/usr/xpg4/bin';
4
5 unless (($groups = `(id -Gn || groups) 2>/dev/null`) ne '') {
6     print "1..0\n";
7     exit 0;
8 }
9
10 print "1..2\n";
11
12 $pwgid = $( + 0;
13 ($pwgnam) = getgrgid($pwgid);
14 @basegroup{$pwgid,$pwgnam} = (1,1);
15
16 $seen{$pwgid}++;
17
18 for (split(' ', $()) {
19     next if $seen{$_}++;
20     ($group) = getgrgid($_);
21     if (defined $group) {
22         push(@gr, $group);
23     }
24     else {
25         push(@gr, $_);
26     }
27
28
29 if ($^O eq "uwin") { # Or anybody else who can have spaces in group names.
30         $gr1 = join(' ', grep(!$did{$_}++, sort split(' ', join(' ', @gr))));
31 } else {
32         $gr1 = join(' ', sort @gr);
33 }
34
35 $gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',$groups)));
36
37 if ($gr1 eq $gr2) {
38     print "ok 1\n";
39 }
40 else {
41     print "#gr1 is <$gr1>\n";
42     print "#gr2 is <$gr2>\n";
43     print "not ok 1\n";
44 }
45
46 # multiple 0's indicate GROUPSTYPE is currently long but should be short
47
48 if ($pwgid == 0 || $seen{0} < 2) {
49     print "ok 2\n";
50 }
51 else {
52     print "not ok 2 (groupstype should be type short, not long)\n";
53 }