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 7BEGIN { 8 chdir 't' if -d 't'; 9 @INC = '../lib'; 10 require './test.pl'; 11} 12 13my @ops = split //, 'rwxoRWXOezsfdlpSbctugkTMBAC'; 14 15plan( tests => @ops * 5 ); 16 17package o { use overload '-X' => sub { 1 } } 18my $o = bless [], 'o'; 19 20for my $op (@ops) { 21 ok( 1 == @{ [ eval "-$op 'TEST'" ] }, "-$op returns single value" ); 22 ok( 1 == @{ [ eval "-$op *TEST" ] }, "-$op *gv returns single value" ); 23 24 my $count = 0; 25 my $t; 26 for my $m ("a", "b") { 27 if ($count == 0) { 28 $t = eval "-$op _" ? 0 : "foo"; 29 } 30 elsif ($count == 1) { 31 is($m, "b", "-$op did not remove too many values from the stack"); 32 } 33 $count++; 34 } 35 36 $count = 0; 37 for my $m ("c", "d") { 38 if ($count == 0) { 39 $t = eval "-$op -e \$^X" ? 0 : "bar"; 40 } 41 elsif ($count == 1) { 42 is($m, "d", "-$op -e \$^X did not remove too many values from the stack"); 43 } 44 $count++; 45 } 46 47 my @foo = eval "-$op \$o"; 48 is @foo, 1, "-$op \$overld did not leave \$overld on the stack"; 49} 50