Add the following packages libalgorithm-diff-perl libspiffy-perl libtext-diff-perl...
[pkg-perl] / deb-src / libtest-base-perl / libtest-base-perl-0.54 / t / diff_is.t
1 use Test::Base tests => 3;
2
3 SKIP: {
4     if ($^O eq 'MSWin32') {
5         skip 'Win32 doesn\'t have /tmp', 3;
6     }
7     
8     unless (Test::Base->have_text_diff) {
9         skip 'The autodiffing feature of Test::Base (which rocketh) requires Text-Diff-0.35 and Algorithm-Diff-1.15 (or greater).', 3;
10     }
11
12     filters { 
13         test => [qw(exec_perl_stdout smooth_output)],
14         expected => 'smooth_output',
15     };
16     run_is;
17
18     sub smooth_output { 
19         s/test-blocks-\d+/test-blocks-321/;
20         s/at line \d+\)/at line 000)/;
21         s/in (.*) at line (\d+)/at $1 line $2/; # for Test::Simple 0.65
22         s/^\n//gm;
23     }
24 }
25
26 __DATA__
27 === little diff
28 --- test
29 use lib 'lib';
30 use Test::Base tests => 1;
31 is('a b c', 'a b x', 'little diff');
32 --- expected
33 1..1
34 not ok 1 - little diff
35 #   Failed test 'little diff'
36 #   in /tmp/test-blocks-321 at line 3.
37 #          got: 'a b c'
38 #     expected: 'a b x'
39 # Looks like you failed 1 test of 1.
40
41
42 === big diff
43 --- test
44 use lib 'lib';
45 use Test::Base tests => 1;
46 is(<<XXX, <<YYY, 'big diff');
47 one
48 two
49 four
50 five
51 XXX
52 one
53 two
54 three
55 four
56 YYY
57 --- expected
58 1..1
59 not ok 1 - big diff
60 # @@ -1,4 +1,4 @@
61 #  one
62 #  two
63 # -three
64 #  four
65 # +five
66
67 #   Failed test 'big diff
68 # @@ -1,4 +1,4 @@
69 #  one
70 #  two
71 # -three
72 #  four
73 # +five
74 # '
75 #   in /tmp/test-blocks-321 at line 3.
76 # Looks like you failed 1 test of 1.
77
78
79 === diff with space - note: doesn't help point out the extra space (yet)
80 --- test
81 use lib 'lib';
82 use Test::Base tests => 1;
83 is(<<XXX, <<YYY, 'diff with space');
84 one
85 two
86 three
87 XXX
88 one
89 two 
90 three
91 YYY
92
93 --- expected
94 1..1
95 not ok 1 - diff with space
96 # @@ -1,3 +1,3 @@
97 #  one
98 # -two 
99 # +two
100 #  three
101
102 #   Failed test 'diff with space
103 # @@ -1,3 +1,3 @@
104 #  one
105 # -two 
106 # +two
107 #  three
108 # '
109 #   in /tmp/test-blocks-321 at line 3.
110 # Looks like you failed 1 test of 1.
111
112