Commit | Line | Data |
---|---|---|
c410dd6a AA |
1 | #!./perl |
2 | ||
3 | # On platforms that don't support all of the filetest operators the code | |
4 | # that faked the results of missing tests used to leave the test's | |
5 | # argument on the stack. | |
6 | ||
7 | BEGIN { | |
8 | chdir 't' if -d 't'; | |
9 | @INC = '../lib'; | |
10 | require './test.pl'; | |
11 | } | |
12 | ||
13 | my @ops = split //, 'rwxoRWXOezsfdlpSbctugkTMBAC'; | |
14 | ||
73ceeaa7 | 15 | plan( tests => @ops * 3 ); |
c410dd6a AA |
16 | |
17 | for my $op (@ops) { | |
18 | ok( 1 == @{ [ eval "-$op 'TEST'" ] }, "-$op returns single value" ); | |
73ceeaa7 B |
19 | |
20 | my $count = 0; | |
21 | my $t; | |
22 | for my $m ("a", "b") { | |
23 | if ($count == 0) { | |
24 | $t = eval "-$op _" ? 0 : "foo"; | |
25 | } | |
26 | elsif ($count == 1) { | |
27 | is($m, "b", "-$op did not remove too many values from the stack"); | |
28 | } | |
29 | $count++; | |
30 | } | |
31 | ||
32 | $count = 0; | |
33 | for my $m ("c", "d") { | |
34 | if ($count == 0) { | |
35 | $t = eval "-$op -e \$^X" ? 0 : "bar"; | |
36 | } | |
37 | elsif ($count == 1) { | |
38 | local $TODO; | |
39 | if ($op eq 'T' or $op eq 't' or $op eq 'B') { | |
40 | $TODO = "[perl #77388] stacked file test does not work with -$op"; | |
41 | } | |
42 | is($m, "d", "-$op -e \$^X did not remove too many values from the stack"); | |
43 | } | |
44 | $count++; | |
45 | } | |
c410dd6a | 46 | } |