add the test files and the perms test

This commit is contained in:
Zane C. B-H 2019-02-14 07:53:25 -06:00
parent 35c8c77ede
commit dea15d87b8
5 changed files with 30 additions and 0 deletions

View File

@ -5,5 +5,6 @@ MANIFEST This list of files
README
t/00-load.t
t/manifest.t
t/perms.t
t/pod-coverage.t
t/pod.t

View File

@ -0,0 +1,29 @@
use strict;
use Test::More qw(no_plan);
use Fcntl ':mode';
BEGIN {
use_ok('File::Find::Rule::UnixPermissions');
}
# fetch all the files, which are user readable
my @returned=File::Find::Rule::UnixPermissions->file
->UnixPermissions(include=>[S_IRUSR])
->in('./test/');
my $joined=join(' ',sort(@returned));
ok( $joined eq 'test/a test/b test/c', 'S_IRUSR') or diag('"'.$joined.'" returned for "a b c"');
# fetch only b, which is the only group writable one that is also user readhable
my @returned=File::Find::Rule::UnixPermissions->file
->UnixPermissions(include=>[S_IRUSR,S_IWGRP])
->in('./test/');
my $joined=join(' ',sort(@returned));
ok( $joined eq 'test/b', 'S_IRUSR+S_IWGRP') or diag('"'.$joined.'" returned for "test/b"');
# fetch b and c, one of which is only group executable and the other is the only one that is group writable
my @returned=File::Find::Rule::UnixPermissions->file
->UnixPermissions(include=>[S_IWGRP,S_IXGRP], any_include=>1)
->in('./test/');
my $joined=join(' ',sort(@returned));
ok( $joined eq 'test/b test/c', 'S_IXGRP or S_IWGRP') or diag('"'.$joined.'" returned for "test/b test/c"');

View File

View File

View File