[gnumeric] Tests: code cleanup.



commit a6e10d753c1bbb5ad290b5dde1d5eb4687d40024
Author: Morten Welinder <terra gnome org>
Date:   Wed Feb 19 18:20:39 2014 -0500

    Tests: code cleanup.

 test/ChangeLog        |    5 +++++
 test/GnumericTest.pm  |    6 +++++-
 test/t6500-strings.pl |   22 +++++++++++++++++-----
 test/t6501-numbers.pl |   22 +++++++++++++++++-----
 test/t6502-styles.pl  |   22 +++++++++++++++++-----
 5 files changed, 61 insertions(+), 16 deletions(-)
---
diff --git a/test/ChangeLog b/test/ChangeLog
index 413b701..4a2b6ef 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-19  Morten Welinder  <terra gnome org>
+
+       * GnumericTest.pm (test_roundtrip): Switch to named arguments
+       since we are going to need more.  All callers changed.
+
 2014-02-16  Morten Welinder <terra gnome org>
 
        * Release 1.12.11
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index 03e0c2f..f98ec0a 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -355,10 +355,14 @@ sub test_exporter {
 # -----------------------------------------------------------------------------
 
 sub test_roundtrip {
-    my ($file,$format,$newext,$resize) = @_;
+    my ($file,%named_args) = @_;
 
     &report_skip ("file $file does not exist") unless -r $file;
 
+    my $format = $named_args{'format'};
+    my $newext = $named_args{'ext'};
+    my $resize = $named_args{'resize'};
+
     my $tmp = fileparse ($file);
     $tmp =~ s/\.([a-zA-Z0-9]+)$// or die "Must have extension for roundtrip test.";
     my $ext = $1;
diff --git a/test/t6500-strings.pl b/test/t6500-strings.pl
index 2d69f9a..47fc216 100755
--- a/test/t6500-strings.pl
+++ b/test/t6500-strings.pl
@@ -8,16 +8,28 @@ use GnumericTest;
 my $file = "$samples/string-tests.gnumeric";
 
 &message ("Check string gnumeric roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_XmlIO:sax', "gnm");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_XmlIO:sax',
+                'ext' => "gnm");
 
 &message ("Check string ods roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_OpenCalc:odf', "ods");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_OpenCalc:odf',
+                'ext' => "ods");
 
 &message ("Check string xls/BIFF7 roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff7', "xls", '16384x256');
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:excel_biff7',
+                'ext' => "xls",
+                'resize' => '16384x256');
 
 &message ("Check string xls/BIFF8 roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff8', "xls");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:excel_biff8',
+                'ext' => "xls");
 
 &message ("Check string xlsx roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:xlsx', "xlsx", '1048576x16384');
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:xlsx',
+                'ext' => "xlsx",
+                'resize' => '1048576x16384');
diff --git a/test/t6501-numbers.pl b/test/t6501-numbers.pl
index 36c6c35..4598ed8 100755
--- a/test/t6501-numbers.pl
+++ b/test/t6501-numbers.pl
@@ -8,16 +8,28 @@ use GnumericTest;
 my $file = "$samples/number-tests.gnumeric";
 
 &message ("Check number gnumeric roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_XmlIO:sax', "gnm");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_XmlIO:sax',
+                'ext' => "gnm");
 
 &message ("Check number ods roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_OpenCalc:odf', "ods");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_OpenCalc:odf',
+                'ext' => "ods");
 
 &message ("Check number xls/BIFF7 roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff7', "xls", '16384x256');
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:excel_biff7',
+                'ext' => "xls",
+                'resize' => '16384x256');
 
 &message ("Check number xls/BIFF8 roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff8', "xls");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:excel_biff8',
+                'ext' => "xls");
 
 &message ("Check number xlsx roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:xlsx', "xlsx", '1048576x16384');
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:xlsx',
+                'ext' => "xlsx",
+                'resize' => '1048576x16384');
diff --git a/test/t6502-styles.pl b/test/t6502-styles.pl
index f2c8cf2..ab5119d 100755
--- a/test/t6502-styles.pl
+++ b/test/t6502-styles.pl
@@ -8,16 +8,28 @@ use GnumericTest;
 my $file = "$samples/style-tests.gnumeric";
 
 &message ("Check style gnumeric roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_XmlIO:sax', "gnm");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_XmlIO:sax',
+                'ext' => "gnm");
 
 &message ("Check style ods roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_OpenCalc:odf', "ods");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_OpenCalc:odf',
+                'ext' => "ods");
 
 &message ("Check style xls/BIFF7 roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff7', "xls", '16384x256');
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:excel_biff7',
+                'ext' => "xls",
+                'resize' => '16384x256');
 
 &message ("Check style xls/BIFF8 roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff8', "xls");
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:excel_biff8',
+                'ext' => "xls");
 
 &message ("Check style xlsx roundtrip.");
-&test_roundtrip ($file, 'Gnumeric_Excel:xlsx', "xlsx", '1048576x16384');
+&test_roundtrip ($file,
+                'format' => 'Gnumeric_Excel:xlsx',
+                'ext' => "xlsx",
+                'resize' => '1048576x16384');


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