diff --git a/t/file-permission.t b/t/file-permission.t index c5613ef..a21270c 100644 --- a/t/file-permission.t +++ b/t/file-permission.t @@ -8,8 +8,10 @@ use Test::More; use lib 't'; use Util; +use constant NTESTS => 10; + plan skip_all => q{Can't be checked under Win32} if is_win32; -plan tests => 10; +plan tests => NTESTS; prep_environment(); @@ -19,16 +21,22 @@ my $program = $0; my $old_mode; (undef, undef, $old_mode) = stat($program); my $nchanged = chmod 0000, $program; -is( $nchanged, 1, sprintf( 'chmodded %s to 0000 from %o', $program, $old_mode ) ); -# execute a search on this file -check_with( 'regex', $program ); -# --count takes a different execution path -check_with( 'regex', '--count', $program ); +SKIP: { + skip q{Unable to modify test program's permissions}, NTESTS unless $nchanged; + + is( $nchanged, 1, sprintf( 'chmodded %s to 0000 from %o', $program, $old_mode ) ); + + # execute a search on this file + check_with( 'regex', $program ); -# change permissions back -chmod $old_mode, $program; -is( $nchanged, 1, sprintf( 'chmodded %s back to %o', $program, $old_mode ) ); + # --count takes a different execution path + check_with( 'regex', '--count', $program ); + + # change permissions back + chmod $old_mode, $program; + is( $nchanged, 1, sprintf( 'chmodded %s back to %o', $program, $old_mode ) ); +} sub check_with { local $Test::Builder::Level = $Test::Builder::Level + 1; diff --git a/tags b/tags index ecc7664..bc4f70b 100644 --- a/tags +++ b/tags @@ -104,6 +104,7 @@ NO_O t/ack-o.t /^NO_O: {$/;" l NO_STARTDIR t/ack-g.t /^NO_STARTDIR: {$/;" l NO_SWITCHES_MULTIPLE_FILES t/ack-h.t /^NO_SWITCHES_MULTIPLE_FILES: {$/;" l NO_SWITCHES_ONE_FILE t/ack-h.t /^NO_SWITCHES_ONE_FILE: {$/;" l +NTESTS t/file-permission.t /^use constant NTESTS => 10;$/;" c ONLY_MAKEFILES t/ack-g.t /^ONLY_MAKEFILES: {$/;" l PARROT_FILES_DESCEND t/interesting.t /^PARROT_FILES_DESCEND: {$/;" l PARROT_FILES_NODESCEND t/interesting.t /^PARROT_FILES_NODESCEND: {$/;" l @@ -125,6 +126,7 @@ SINGLE_TEXT_MATCH_ENV t/ack-env.t /^SINGLE_TEXT_MATCH_ENV: {$/;" l SINGLE_TEXT_MATCH_NOENV t/ack-env.t /^SINGLE_TEXT_MATCH_NOENV: {$/;" l SKIP t/ack-passthru.t /^ SKIP: {$/;" l SKIP t/context.t /^ SKIP: {$/;" l +SKIP t/file-permission.t /^SKIP: {$/;" l SPECIFYING_A_BAK_FILE t/command-line-files.t /^SPECIFYING_A_BAK_FILE: {$/;" l STANDARD_GROUPING t/ack-group.t /^STANDARD_GROUPING: {$/;" l STARTING_POINTS t/module.t /^STARTING_POINTS: {$/;" l