3 # Some tests for the --set-scripts-executable option.
6 use Test
::More
'no_plan';
12 my $test_dir = abs_path
();
15 pass
'test does not work on windows';
17 my $test_name = 'darcs pull --set-scripts-executable works';
19 use File
::Temp
'tempdir';
20 chdir tempdir
( CLEANUP
=> 1 );
26 cp
"$test_dir/".__FILE__
, 'script.pl' || die $!;
27 chmod 0644, 'script.pl' || die $!;
28 system 'date > nonscript';
29 ok
( (-r
'script.pl'), 'pre test: script exists and is readable' );
30 ok
( ! (-x
'script.pl'), 'pre test: script is not executable' );
31 ok
( (-r
'nonscript'), 'pre test: nonscript exists and is readable' );
32 ok
( ! (-x
'nonscript'), 'pre test: nonscript is not executable' );
34 darcs
'add script.pl nonscript';
35 like
( ( darcs qw
!record
--patch
-name
'uno' --all
! ), qr/finished recording/i );
37 # sans --set-scripts-executable (should not be executable)
41 like
( ( darcs qw
%pull -a
../temp1 %) , qr/finished pulling
/i
);
42 ok
( (-r
'script.pl'), 'reality check: file has been pulled and is readable' );
43 ok
( (-r
'nonscript'), 'reality check: other file has been pulled and is readable' );
45 ok
(! (-x
'script.pl'), "nothing should be executable");
46 ok
(! (-x
'nonscript'), "nothing should be executable" );
49 # darcs pull --set-scripts-executable
54 like
( ( darcs qw
%pull --set
-scripts
-executable
-a
../temp1
%) ,
55 qr/finished pulling/i );
56 ok
( (-r
'script.pl'), 'reality check: file has been pulled and is readable' );
57 ok
( (-r
'nonscript'), 'reality check: other file has been pulled and is readable' );
59 ok
( (-x
'script.pl'), $test_name );
60 ok
(! (-x
'nonscript'), "innocent bystanders aren't set to be executable" );
61 chdir '../'; # now outside of any repo
63 # now let's try the same thing with get
65 like
( darcs
('get --set-scripts-executable temp1 temp2') ,
68 ok
( (-r
'script.pl'), 'reality check: file has been gotten and is readable' );
69 ok
( (-r
'nonscript'), 'reality check: other file has been gotten and is readable' );
71 ok
( (-x
'script.pl'), $test_name );
72 ok
(! (-x
'nonscript'), "innocent bystanders aren't set to be executable" );