summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-06-13 17:50:14 +0200
committerNicholas Clark <nick@ccl4.org>2012-06-21 09:00:36 +0200
commitb050b2f87c512aa139aa4b162950f6c89cea3ff1 (patch)
treeb0a5d4a471e3ee33e7dfdd9ec1572017bbc26804 /lib
parentcf23dc19b46f3d95146b1e58fd518288359d7a48 (diff)
downloadperl-b050b2f87c512aa139aa4b162950f6c89cea3ff1.tar.gz
In lib/File/stat.t, permute the test file's mode for more thorough testing.
For each mode bit set, and all bits clear, test each filetest operator with and without a File::stat object. Previously the only test was for the mode the file was created with.
Diffstat (limited to 'lib')
-rw-r--r--lib/File/stat.t11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/File/stat.t b/lib/File/stat.t
index 938e3e3c14..bae8aa93cc 100644
--- a/lib/File/stat.t
+++ b/lib/File/stat.t
@@ -97,6 +97,17 @@ sub test_X_ops {
test_X_ops($file, "for $file");
+{
+ my $mode = 01000;
+ while ($mode) {
+ $mode >>= 1;
+ my $mode_oct = sprintf "0%03o", $mode;
+ chmod $mode, $file or die "Can't chmod $mode_oct $file: $!";
+ test_X_ops($file, "for file with mode=$mode_oct");
+ }
+ chmod 0600, $file or die "Can't restore permissions on $file to 0600";
+}
+
SKIP: {
-e $^X && -x $^X or skip "$^X is not present and executable", 4;
$^O eq "VMS" and skip "File::stat ignores VMS ACLs", 4;