[gnumeric] Tests: add ability to silence unimportant differences in roundtrips.



commit 2e372a80dfd70ea4ba88c1519711edcb21145581
Author: Morten Welinder <terra gnome org>
Date:   Wed Feb 19 18:29:02 2014 -0500

    Tests: add ability to silence unimportant differences in roundtrips.

 test/GnumericTest.pm  |    7 +++++--
 test/t6500-strings.pl |    3 ++-
 test/t6501-numbers.pl |    3 ++-
 test/t6502-styles.pl  |    3 ++-
 4 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index f98ec0a..8ae54f7 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -363,6 +363,9 @@ sub test_roundtrip {
     my $newext = $named_args{'ext'};
     my $resize = $named_args{'resize'};
 
+    my $filter1 = $named_args{'filter1'} || $named_args{'filter'} || 'cat';
+    my $filter2 = $named_args{'filter2'} || $named_args{'filter'} || 'cat';
+
     my $tmp = fileparse ($file);
     $tmp =~ s/\.([a-zA-Z0-9]+)$// or die "Must have extension for roundtrip test.";
     my $ext = $1;
@@ -389,12 +392,12 @@ sub test_roundtrip {
 
     my $tmp_xml = "$tmp.xml";
     &junkfile ($tmp_xml) unless $keep;
-    $code = system ("zcat -f '$file_resized' | $PERL normalize-gnumeric >'$tmp_xml'");
+    $code = system ("zcat -f '$file_resized' | $PERL normalize-gnumeric | $filter1 >'$tmp_xml'");
     &system_failure ('zcat', $code) if $code;
 
     my $tmp2_xml = "$tmp-new.xml";
     &junkfile ($tmp2_xml) unless $keep;
-    $code = system ("zcat -f '$tmp2' | $PERL normalize-gnumeric >'$tmp2_xml'");
+    $code = system ("zcat -f '$tmp2' | $PERL normalize-gnumeric | $filter2 >'$tmp2_xml'");
     &system_failure ('zcat', $code) if $code;
 
     $code = system ('diff', '-u', $tmp_xml, $tmp2_xml);
diff --git a/test/t6500-strings.pl b/test/t6500-strings.pl
index 47fc216..bbdeb32 100755
--- a/test/t6500-strings.pl
+++ b/test/t6500-strings.pl
@@ -15,7 +15,8 @@ my $file = "$samples/string-tests.gnumeric";
 &message ("Check string ods roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
-                'ext' => "ods");
+                'ext' => "ods",
+                'filter2' => "perl -p -e '\$_ = \"\" if m{<meta:generator>}'");
 
 &message ("Check string xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6501-numbers.pl b/test/t6501-numbers.pl
index 4598ed8..a3085e6 100755
--- a/test/t6501-numbers.pl
+++ b/test/t6501-numbers.pl
@@ -15,7 +15,8 @@ my $file = "$samples/number-tests.gnumeric";
 &message ("Check number ods roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
-                'ext' => "ods");
+                'ext' => "ods",
+                'filter2' => "perl -p -e '\$_ = \"\" if m{<meta:generator>}'");
 
 &message ("Check number xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,
diff --git a/test/t6502-styles.pl b/test/t6502-styles.pl
index ab5119d..f853479 100755
--- a/test/t6502-styles.pl
+++ b/test/t6502-styles.pl
@@ -15,7 +15,8 @@ my $file = "$samples/style-tests.gnumeric";
 &message ("Check style ods roundtrip.");
 &test_roundtrip ($file,
                 'format' => 'Gnumeric_OpenCalc:odf',
-                'ext' => "ods");
+                'ext' => "ods",
+                'filter2' => "perl -p -e '\$_ = \"\" if m{<meta:generator>}'");
 
 &message ("Check style xls/BIFF7 roundtrip.");
 &test_roundtrip ($file,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]