filetest.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!./perl
# There are few filetest operators that are portable enough to test.
# See pod/perlport.pod for details.
BEGIN {
chdir 't' if -d 't';
}
use Config;
print "1..10\n";
print "ok 1\n";
print "ok 2\n";
print "not " if -f 'op';
print "ok 3\n";
print "not " if -d 'TEST';
print "ok 4\n";
print "ok 5\n";
# make sure TEST is r-x
$bad_chmod = $@;
$oldeuid = $>; # root can read and write anything
eval '$> = 1'; # so switch uid (may not be implemented)
print "ok 6 #skipped, no seteuid\n";
}
print "#[$@]\nok 6 #skipped\n";
}
else {
print "not " if -w 'TEST';
print "ok 6\n";
}
# Scripts are not -x everywhere so cannot test that.
eval '$> = $oldeuid'; # switch uid back (may not be implemented)
# this would fail for the euid 1
# (unless we have unpacked the source code as uid 1...)
print "ok 7\n";
# this would fail for the euid 1
# (unless we have unpacked the source code as uid 1...)
print "ok 8\n";
} else {
print "ok 8 #skipped, no seteuid\n";
}
print "ok 9\n";
print "ok 10\n";