File: executable.t

package info (click to toggle)
libfile-chmod-perl 0.42-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 224 kB
  • sloc: perl: 476; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use warnings;
use Test::More;
use English '-no_match_vars';
use File::Temp ();
use File::chmod qw( chmod getmod );
$File::chmod::UMASK = 0;

plan skip_all => "Windows perms work differently" if $OSNAME eq 'MSWin32';

my $tmp = File::Temp->new;
my $fn  = $tmp->filename;

note sprintf "original state of %s: %o\n", $fn, getmod( $fn );

ok chmod("+x", $fn ), "chmod +x $fn";
ok -x $fn, "$fn executable";

ok chmod("-x", $fn ), "chmod -x $fn";
ok ! -x $fn, "$fn not executable";

done_testing;