3 # Some tests for 'darcs rec --edit-long-comment'
6 use Test
::More
'no_plan';
12 use File
::Temp
'tempdir';
13 chdir tempdir
( CLEANUP
=> 1 );
15 my $GREP = `which grep`;
25 write_file
('file.t',"FIRST LINE\n");
33 ok
((!-d
$d), 'temp1 directory was deleted');
36 $ENV{DARCS_EDITOR
}="/bin/cat -n";
38 my $test_name = 'editor: space in command';
41 like
(darcs
('record --edit-long-comment -a -m foo file.t'), qr/2.*END OF DESCRIPTION/i, $test_name);
44 $test_name = 'editor: space in path';
48 like
(darcs
('record --edit-long-comment -a -m foo file.t'), qr/2.*END OF DESCRIPTION/i, $test_name);
52 $ENV{DARCS_EDITOR
}=${GREP
}.' "END OF"';
54 $test_name = 'editor: quoting in command';
56 init_dir
('temp1','temp1');
57 like
(darcs
('record --edit-long-comment -a -m foo file.t'), qr/END OF/i, $test_name);
58 clean_dir
('temp1','temp1');
60 $ENV{DARCS_EDITOR
}='/bin/echo';
62 $test_name = 'editor: evil filename';
64 init_dir
('temp1','temp1');
65 `touch '; test-command'`;
66 `printf "#!/bin/sh\necho EVIL" > test-command`;
67 `chmod u+x test-command`;
68 my $op = darcs
(qw(record --logfile='; test-command' --edit-long-comment -a -m foo file.t));
69 unlike
($op, qr/EVIL/i, $test_name);
70 clean_dir
('temp1','temp1');