Introspection: add col/row manipulations
[gnumeric.git] / test / t9004-ssdiff-highlight.pl
bloba2f81e22bb680a094abb34fc6052c9b47f9e91eb
1 #!/usr/bin/perl -w
2 # -----------------------------------------------------------------------------
4 use strict;
5 use lib ($0 =~ m|^(.*/)| ? $1 : ".");
6 use GnumericTest;
8 &message ("Check ssdiff's highlight mode");
10 my $tmp = "junk.gnumeric";
11 &GnumericTest::junkfile ($tmp);
13 my @sources = &GnumericTest::corpus();
15 my $nskipped = 0;
16 my @pairs = ();
17 @sources = grep { -r $_ ? 1 : ($nskipped++, 0) } @sources;
18 while (@sources >= 2) {
19 my $first = shift @sources;
20 my $second = shift @sources;
21 push @pairs, [$first,$second];
24 my $ngood = 0;
25 my $nbad = 0;
26 for my $p (@pairs) {
27 my ($first,$second) = @$p;
29 print STDERR "$first vs $second...\n";
31 my $cmd = "$ssdiff --highlight --output=$tmp $first $second";
32 print STDERR "$cmd\n" if $GnumericTest::verbose;
33 my $output = `$cmd 2>&1`;
34 my $err = $?;
35 if ($err == (1 << 8)) {
36 &GnumericTest::dump_indented ($output);
37 $ngood++;
38 } else {
39 &GnumericTest::dump_indented ($output || '(no output)');
40 $nbad++;
41 die "Failed command: $cmd [$err]\n" if $err > (1 << 8);
45 &GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
47 if ($nskipped > 0) {
48 print STDERR "$nskipped files skipped.\n";
51 if ($nbad > 0) {
52 die "Fail\n";
53 } else {
54 print STDERR "Pass\n";