File: whatsnew.pl

package info (click to toggle)
darcs 2.0.2-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,400 kB
  • ctags: 1,048
  • sloc: haskell: 24,937; perl: 9,736; sh: 3,369; ansic: 1,913; makefile: 17; xml: 14
file content (52 lines) | stat: -rw-r--r-- 1,262 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env perl

# Some tests for 'darcs whatsnew '

use lib 'lib/perl';
use Test::More 'no_plan';
use Shell::Command;
use Test::Darcs;
use Shell::Command;
use File::Slurp;
use strict;
use Cwd 'abs_path';

init_tmp_repo();

{
  my $testname = "RT#505 whatsnew -s after removal of file without a newline";
  write_file('foo',"foobar");
  like ( darcs('record -la -m "add foo"'), qr/Finished record/,
         'recorded patch adding foo');
  rm_rf 'foo';
  like ( darcs('whatsnew -s'), qr/R/, $testname );
  darcs 'record -a -m "remove foo"';
}

{
    my $test_name = 'RT#245 --look-for-adds implies --summary';
    touch('look_summary.txt');
    like( darcs('whatsnew -l'), qr!a ./look_summary.txt!i, $test_name);
}


my $test_name = 'whatsnew works with uncommon file names';

if ($^O =~ /(msys|win32)/i) {
    pass 'test does not work on windows';
} else {
    touch(qw/\\/);

    my $before  = darcs(qw/add \\\\/);
    my $what = darcs 'whatsnew';
    unlike($what, qr/no changes/i, $test_name);
}

{
    my $test_name = 'whatsnew works with absolute paths';
    my $abs_repo_path = abs_path();
    write_file('date.t','date.t');
    touch 'date.t';
    darcs 'add date.t';
    like( darcs(qq{whatsnew  "$abs_repo_path/date.t"}), qr/hunk/i, $test_name);
}