3 # Some tests for 'darcs push'
6 use Test
::More tests
=> 7;
10 use File
::Temp
'tempdir';
11 chdir tempdir
( CLEANUP
=> 1 );
14 mkpath
'temp2/one/two';
22 my $test_name = 'push without a repo gives an error';
24 my $out = darcs qw
/push -p 123/;
25 like
($out,qr/missing argument/i,$test_name);
30 chdir './temp2/one/two';
31 my $test_name = 'darcs push should work relative to the current directory';
32 my $push_out = darcs qw
!push -a
../../../temp1
!;
33 like
($push_out, qr/No recorded local changes to push/i, $test_name);
34 chdir '../../../'; # above temp repos
38 my $test_name = 'darcs push should push into repo specified with --repo';
41 darcs
"record --patch-name 'uno' --all";
42 chdir '../'; # now outside of any repo
44 like
(darcs
(qw
!push --repodir temp2
--all
"../temp1"!), # temp2 is relative to temp1
45 qr/Finished apply./i, $test_name);
51 my $default_repo_pre_test = 'Before trying to pull from self, defaultrepo does not exist';
52 ok
( (! -r
'./_darcs/prefs/defaultrepo'),$default_repo_pre_test);
54 my $test_name = 'return special message when you try to push to yourself';
56 like
( darcs
(qw
/push -a/,getcwd
()), qr/Can't push to current repository!/i, $test_name);
57 like
( darcs
(qw
/push -a ./), qr/Can't push to current repository!/i, $test_name);
59 my $set_default_repo_test = "and don't update the default repo to be the current dir";
60 ok
( (! -r
'./_darcs/prefs/defaultrepo'),$set_default_repo_test);
62 chdir '../'; # now outside of any repo