Shutdown: help the style leak printer out a bit.
[gnumeric.git] / test / t9002-ssdiff-self.pl
blobbdcd6cb6834a77b96865b177b911d8b3908eb1bd
1 #!/usr/bin/perl -w
2 # -----------------------------------------------------------------------------
4 use strict;
5 use lib ($0 =~ m|^(.*/)| ? $1 : ".");
6 use GnumericTest;
8 &message ("Check ssdiff on identical files");
10 my @sources = &GnumericTest::corpus();
12 my $ngood = 0;
13 my $nbad = 0;
14 my $nskipped = 0;
16 for my $src (@sources) {
17 if (!-r $src) {
18 $nskipped += 2;
19 next;
22 print STDERR "$src...\n";
24 my $cmd = "$ssdiff --xml $src $src";
25 my $output = `$cmd 2>&1`;
26 my $err = $?;
27 if ($err) {
28 &GnumericTest::dump_indented ($output);
29 $nbad++;
30 die "Failed command: $cmd [$err]\n" if $err > (1 << 8);
31 } else {
32 if ($output =~ m'<\?xml version="1\.0" encoding="UTF-8"\?>
33 <s:Diff xmlns:s=".*">
34 ( <s:Sheet Name=".*" Old="\d+" New="\d+"/>
35 )*</s:Diff>') {
36 $ngood++;
37 } else {
38 &GnumericTest::dump_indented ($output);
39 $nbad++;
44 &GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
46 if ($nskipped > 0) {
47 print STDERR "$nskipped files skipped.\n";
50 if ($nbad > 0) {
51 die "Fail\n";
52 } else {
53 print STDERR "Pass\n";