update readmes
[git-darcs-import.git] / tests / record.pl
blob2fa953a3a53f02c13ee4f0bfc490d1380c90d40c
1 #!/usr/bin/env perl
3 # Some tests for 'darcs record '
5 use lib 'lib/perl';
6 use Test::More 'no_plan';
7 use Test::Darcs;
8 use strict;
9 use Shell::Command;
10 use File::Slurp;
11 use Cwd;
13 init_tmp_repo();
16 my $test_name = 'issue308 - no patches and no deps for record should abort';
17 like( darcs(qw/record -am foo --ask-deps/), qr/Ok, if you don't want to record anything, that's fine!/i,
18 $test_name) ;
21 if ($^O =~ /msys/i) {
22 pass 'test does not work on msys due to stdin oddities';
23 } else {
24 my $test_name = 'RT#476 - --ask-deps works when there are no patches';
25 touch 't.f';
26 darcs qw/add t.f/;
27 like( darcs(qw/record -am add/), qr/Finished recording/i, "add file") ;
28 like( echo_to_darcs("record -am foo --ask-deps",'a'), qr/finished recording/i, $test_name) ;
29 is($?, 0, "record no-patch return code == 0");
33 my $test_name = 'RT#231 - special message is given for nonexistent directories';
34 like( darcs(qw/record -am foo not_there.txt/),qr/non ?existent/i, $test_name) ;
38 my $test_name = 'RT#231 - a nonexistent file before an existing file is handled correctly';
39 touch 'b.t';
40 like( darcs(qw/record -am foo a.t b.t/),
41 qr/Non ?existent files or directories: "a.t"/i, $test_name) ;
45 my $test_name = 'record works with absolute paths';
47 touch 'date.t';
48 darcs qw/add date.t/;
50 like( darcs(q{record -a -m foo "}
51 .cwd()
52 .q{/date.t"} ), qr/Finished recording/i, $test_name);
56 my $test_name = 'issue396 - record -l ""';
57 touch 'notnull.t';
58 like( darcs(qw/record -am foo -l "" notnull.t/), qr/Finished recording/i, $test_name) ;
61 BASIC_RECORD: {
62 my $test_name = 'basic record';
63 `date >> date.t`;
64 like( darcs(qw/record -a -m basic_record date.t/), qr/finished recording/i, $test_name);
67 LOGFILE: {
68 my $test_name = 'testing --logfile';
69 `date >> date.t`;
70 append_file('log.txt',"second record\n");
71 like( darcs(qw/record -a -m 'second record' --logfile=log.txt date.t/), qr/finished recording/i, $test_name);