Set initial commit timestamp to be constant.
[git-darcs-import.git] / tests / changes_with_move.pl
blob14f0b6c73324c4bab30c889b1fd8f4a998167250
1 #!/usr/bin/env perl
3 # Some tests for the output of changes when combined with move.
5 use lib 'lib/perl';
6 use Test::More 'no_plan';
7 use Test::Darcs;
8 use Shell::Command;
9 use strict;
10 use warnings;
12 init_tmp_repo();
14 `date > foo`; # create foo!
16 like(darcs(q(add foo)), qr/^$/,
17 "darcs add reports nothing");
19 like(darcs(q( record -m 'add foo' -a)), qr/Finished recording patch 'add foo'/,
20 "darcs record reports 'Finished recording patch 'add foo''");
22 mkpath 'd';
24 like(darcs('add d'), qr/^$/,
25 "darcs add reports nothing");
27 like(darcs(q( record -m 'add d' -a)), qr/Finished recording patch 'add d'/,
28 "darcs record reports 'Finished recording patch 'add d''");
30 like(darcs(q( mv foo d)), qr/^$/,
31 "darcs mv reports nothing");
33 like(darcs(q( record -m 'mv foo to d' -a)),
34 qr/Finished recording patch 'mv foo to d'/,
35 "darcs record reports 'Finished recording patch 'mv foo to d''");
37 like(darcs(q( mv d directory)), qr/^$/,
38 "darcs mv reports nothing");
40 like(darcs(q( record -m 'mv d to directory' -a)),
41 qr/Finished recording patch 'mv d to directory'/,
42 "darcs record reports 'Finished recording patch 'mv d to directory''");
44 use File::Slurp;
45 write_file('directory/foo', 'How beauteous mankind is');
47 like(darcs(q( record -m 'modify directory/foo' -a)),
48 qr/Finished recording patch 'modify directory\/foo'/,
49 "darcs record reports 'Finished recording patch 'modify directory/foo''");
51 my $changes_output = darcs(q( changes directory/foo));
52 like($changes_output, qr/add foo/,
53 "darcs changes reports 'add foo'");
54 like($changes_output, qr/mv foo to d/,
55 "darcs changes reports 'mv foo to d'");
57 write_file('directory/foo', 'O brave new world');
59 like(darcs(q( mv directory/foo directory/bar)), qr/^$/,
60 "darcs mv reports nothing");
62 write_file('directory/foo','echo That has such people in it');
64 like(darcs(q( add directory/foo)), qr/^$/,
65 "darcs add reports nothing");
67 like(darcs(q( record -m 'mv foo then add new foo' -a)),
68 qr/Finished recording patch 'mv foo then add new foo'/,
69 "darcs record reports 'Finished recording patch 'mv foo then add new foo''");
71 my $annotate_output = darcs(q( annotate directory/bar));
72 like($annotate_output, qr/How beauteous mankind is/,
73 "darcs annotate reports 'How beauteous mankind is'");
74 like($annotate_output, qr/O brave new world/,
75 "darcs annotate reports 'O brave new world'");