| 1 |
#!/usr/bin/env perl |
| 2 |
|
| 3 |
use 5.014000; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use Test::More; |
| 7 |
use Capture::Tiny "capture"; |
| 8 |
|
| 9 |
binmode STDOUT, ":encoding(utf-8)"; |
| 10 |
binmode STDERR, ":encoding(utf-8)"; |
| 11 |
binmode DATA, ":encoding(utf-8)"; |
| 12 |
|
| 13 |
# localtime will differ on other machines |
| 14 |
my %stamp = map { s{^Files/}{}r => "$_ ".localtime ((stat)[9]) } glob "Files/*"; |
| 15 |
|
| 16 |
local $/ = "** EOT **\n"; |
| 17 |
while (<DATA>) { |
| 18 |
chomp; |
| 19 |
my ($dsc, $f1, $f2, $opt, $exp) = split m/\n/, $_, 5; |
| 20 |
$exp =~ s/STAMP:1/$stamp{$f1}/g; |
| 21 |
$exp =~ s/STAMP:2/$stamp{$f2}/g; |
| 22 |
#diag "Description: $dsc"; |
| 23 |
#diag "Options: $opt"; |
| •24 |
my $path = ( $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.' ); |
| 25 |
my @cmd = ($^X, "$path/ccdiff", "--utf-8", "--no-color", "Files/$f1", "Files/$f2"); |
| 26 |
$opt and push @cmd, split m/ / => $opt; |
| 27 |
#diag "@cmd"; |
| 28 |
my ($out, $err, $exit) = capture { system @cmd; }; |
| 29 |
is ($out, $exp, $dsc); |
| 30 |
is ($err, "", "No error"); |
| 31 |
is ($exit, 0, "Success"); |
| 32 |
} |
| 33 |
|
| 34 |
done_testing; |
| 35 |
|
| 36 |
__END__ |
| 37 |
No options |
| 38 |
01_1.txt |
| 39 |
01_2.txt |
| 40 |
|
| 41 |
< STAMP:1 |
| 42 |
> STAMP:2 |
| 43 |
3,3c3,3 |
| 44 |
< usu. Ad duo posse theophrastus, vim in accumsan |
| 45 |
--- |
| 46 |
> usu. Ad duo posse theophrastus. Vim in accumsan |
| 47 |
** EOT ** |
| 48 |
Unified with header |
| 49 |
01_1.txt |
| 50 |
01_2.txt |
| 51 |
-u0 |
| 52 |
--- STAMP:1 |
| 53 |
+++ STAMP:2 |
| 54 |
3,3c3,3 |
| 55 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 56 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 57 |
** EOT ** |
| 58 |
No header |
| 59 |
01_1.txt |
| 60 |
01_2.txt |
| 61 |
--no-header |
| 62 |
3,3c3,3 |
| 63 |
< usu. Ad duo posse theophrastus, vim in accumsan |
| 64 |
--- |
| 65 |
> usu. Ad duo posse theophrastus. Vim in accumsan |
| 66 |
** EOT ** |
| 67 |
Unified with header |
| 68 |
01_1.txt |
| 69 |
01_2.txt |
| 70 |
-u0 |
| 71 |
--- STAMP:1 |
| 72 |
+++ STAMP:2 |
| 73 |
3,3c3,3 |
| 74 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 75 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 76 |
** EOT ** |
| 77 |
Unified without header |
| 78 |
01_1.txt |
| 79 |
01_2.txt |
| 80 |
-u0 --no-header |
| 81 |
3,3c3,3 |
| 82 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 83 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 84 |
** EOT ** |
| 85 |
Unified with ascii markers |
| 86 |
01_1.txt |
| 87 |
01_2.txt |
| 88 |
-mau0 --no-header |
| 89 |
3,3c3,3 |
| 90 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 91 |
- ^ ^ |
| 92 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 93 |
+ ^ ^ |
| 94 |
** EOT ** |
| 95 |
Unified with unicode markers |
| 96 |
01_1.txt |
| 97 |
01_2.txt |
| 98 |
-mu0 --no-header |
| 99 |
3,3c3,3 |
| 100 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 101 |
- ▼ ▼ |
| 102 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 103 |
+ ▲ ▲ |
| 104 |
** EOT ** |
| 105 |
Unified with ascii markers and context |
| 106 |
01_1.txt |
| 107 |
01_2.txt |
| 108 |
-mau1 |
| 109 |
--- STAMP:1 |
| 110 |
+++ STAMP:2 |
| 111 |
3,3c3,3 |
| 112 |
id vix cibo omittantur, et impetus offendit convenire |
| 113 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 114 |
- ^ ^ |
| 115 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 116 |
+ ^ ^ |
| 117 |
efficiantur, sed in congue decore. Ex nullam iudicabit |
| 118 |
** EOT ** |
| 119 |
Unified with ascii verbose 1 |
| 120 |
01_1.txt |
| 121 |
01_2.txt |
| 122 |
-au0 -v1 --no-header |
| 123 |
3,3c3,3 |
| 124 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 125 |
- -- verbose : COMMA, LATIN SMALL LETTER V |
| 126 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 127 |
+ -- verbose : FULL STOP, LATIN CAPITAL LETTER V |
| 128 |
** EOT ** |
| 129 |
Unified with unicode verbose 1 |
| 130 |
01_1.txt |
| 131 |
01_2.txt |
| 132 |
-u0 -v1 --no-header |
| 133 |
3,3c3,3 |
| 134 |
-usu. Ad duo posse theophrastus, vim in accumsan |
| 135 |
- -- verbose : COMMA, LATIN SMALL LETTER V |
| 136 |
+usu. Ad duo posse theophrastus. Vim in accumsan |
| 137 |
+ -- verbose : FULL STOP, LATIN CAPITAL LETTER V |
| 138 |
** EOT ** |
| 139 |
Unified with ascii verbose 2 |
| 140 |
01_1.txt |
| 141 |
01_2.txt |
| 142 |
-au0 -v2 --no-header |
| 143 |
3,3c3,3 |
| 144 |
-usu. Ad duo posse theophrastus>,< >v<im in accumsan |
| 145 |
- -- verbose : COMMA, LATIN SMALL LETTER V |
| 146 |
+usu. Ad duo posse theophrastus>.< >V<im in accumsan |
| 147 |
+ -- verbose : FULL STOP, LATIN CAPITAL LETTER V |
| 148 |
** EOT ** |
| 149 |
Unified with unicode verbose 2 |
| 150 |
01_1.txt |
| 151 |
01_2.txt |
| 152 |
-u0 -v2 --no-header |
| 153 |
3,3c3,3 |
| 154 |
-usu. Ad duo posse theophrastus↱,↰ ↱v↰im in accumsan |
| 155 |
- -- verbose : COMMA, LATIN SMALL LETTER V |
| 156 |
+usu. Ad duo posse theophrastus↱.↰ ↱V↰im in accumsan |
| 157 |
+ -- verbose : FULL STOP, LATIN CAPITAL LETTER V |
| 158 |
** EOT ** |