[libgsf] Tests: minor test improvements.



commit 60ca3c14109c60d141e8c6b5b3eeaec6dfc9f94d
Author: Morten Welinder <terra gnome org>
Date:   Tue Dec 2 17:44:58 2014 -0500

    Tests: minor test improvements.

 ChangeLog                   |    8 ++++++++
 tests/LibGsfTest.pm         |    2 +-
 tests/t8000-valgrind-zip.pl |   12 ++++++++++--
 tests/t8020-valgrind-ole.pl |   12 ++++++++++--
 tests/t8040-valgrind-tar.pl |   10 +++++++++-
 tools/gsf.c                 |   21 ++++++---------------
 6 files changed, 44 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7ffafc6..8a036ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-02  Morten Welinder  <terra gnome org>
+
+       * tests/LibGsfTest.pm (test_valgrind): Dump valgrind output when
+       verbose.
+
+       * tools/gsf.c (gsf_create): Use our perfectly fine GType macros
+       instead of a home grown enum.
+
 2014-12-01  Morten Welinder  <terra gnome org>
 
        * gsf/gsf-output-stdio.c (follow_symlinks): Plug leak.
diff --git a/tests/LibGsfTest.pm b/tests/LibGsfTest.pm
index af1e983..5ca3b96 100644
--- a/tests/LibGsfTest.pm
+++ b/tests/LibGsfTest.pm
@@ -218,7 +218,7 @@ sub test_valgrind {
        ? $1
        : -1;
     if ($errors == 0) {
-       # &dump_indented ($txt);
+       &dump_indented ($txt) if $verbose;
        print STDERR "Pass\n";
        return;
     }
diff --git a/tests/t8000-valgrind-zip.pl b/tests/t8000-valgrind-zip.pl
index e352ace..7b91dcf 100755
--- a/tests/t8000-valgrind-zip.pl
+++ b/tests/t8000-valgrind-zip.pl
@@ -10,10 +10,18 @@ my $archive = "test.zip";
 
 my @files = ('Makefile.am', 'common.supp');
 
-print STDERR "Testing zip write\n";
+print STDERR "Testing zip create\n";
 &test_valgrind ("$gsf createzip $archive @files", 1);
 print STDERR "\n";
 
-print STDERR "Testing zip read\n";
+print STDERR "Testing zip list\n";
 &test_valgrind ("$gsf list $archive >/dev/null", 1);
 print STDERR "\n";
+
+print STDERR "Testing zip listprops\n";
+&test_valgrind ("$gsf listprops $archive >/dev/null", 1);
+print STDERR "\n";
+
+print STDERR "Testing zip cat\n";
+&test_valgrind ("$gsf cat $archive @files >/dev/null", 1);
+print STDERR "\n";
diff --git a/tests/t8020-valgrind-ole.pl b/tests/t8020-valgrind-ole.pl
index f4e79da..e33151a 100755
--- a/tests/t8020-valgrind-ole.pl
+++ b/tests/t8020-valgrind-ole.pl
@@ -10,10 +10,18 @@ my $archive = "test.ole";
 
 my @files = ('Makefile.am', 'common.supp');
 
-print STDERR "Testing ole write\n";
+print STDERR "Testing ole create\n";
 &test_valgrind ("$gsf createole $archive @files", 1);
 print STDERR "\n";
 
-print STDERR "Testing ole read\n";
+print STDERR "Testing ole list\n";
 &test_valgrind ("$gsf list $archive >/dev/null", 1);
 print STDERR "\n";
+
+print STDERR "Testing ole listprops\n";
+&test_valgrind ("$gsf listprops $archive >/dev/null", 1);
+print STDERR "\n";
+
+print STDERR "Testing ole cat\n";
+&test_valgrind ("$gsf cat $archive @files >/dev/null", 1);
+print STDERR "\n";
diff --git a/tests/t8040-valgrind-tar.pl b/tests/t8040-valgrind-tar.pl
index 3dd0ad4..2a7501b 100755
--- a/tests/t8040-valgrind-tar.pl
+++ b/tests/t8040-valgrind-tar.pl
@@ -19,6 +19,14 @@ if (0) {
     system ("tar", "cf", $archive, @files);
 }
 
-print STDERR "Testing tar read\n";
+print STDERR "Testing tar list\n";
 &test_valgrind ("$gsf list $archive >/dev/null", 1);
 print STDERR "\n";
+
+print STDERR "Testing tar listprops\n";
+&test_valgrind ("$gsf listprops $archive >/dev/null", 1);
+print STDERR "\n";
+
+print STDERR "Testing tar cat\n";
+&test_valgrind ("$gsf cat $archive @files >/dev/null", 1);
+print STDERR "\n";
diff --git a/tools/gsf.c b/tools/gsf.c
index a315873..e8c1393 100644
--- a/tools/gsf.c
+++ b/tools/gsf.c
@@ -24,11 +24,6 @@ static GOptionEntry const gsf_options [] = {
        { NULL, 0, 0, 0, NULL, NULL, NULL}
 };
 
-typedef enum {
-       GSF_OUTFILE_TYPE_MSOLE,
-       GSF_OUTFILE_TYPE_ZIP
-} GsfOutfileType;
-
 /* ------------------------------------------------------------------------- */
 
 static GsfInfile *
@@ -451,7 +446,7 @@ load_recursively (GsfOutfile *outfile, char const *path)
 }
 
 static int
-gsf_create (int argc, char **argv, GsfOutfileType type)
+gsf_create (int argc, char **argv, GType type)
 {
        char const *filename;
        GError *error = NULL;
@@ -470,16 +465,12 @@ gsf_create (int argc, char **argv, GsfOutfileType type)
                return 1;
        }
 
-       switch (type) {
-       case GSF_OUTFILE_TYPE_MSOLE:
+       if (type == GSF_OUTFILE_MSOLE_TYPE)
                outfile = gsf_outfile_msole_new (dest);
-               break;
-       case GSF_OUTFILE_TYPE_ZIP:
+       else if (type == GSF_OUTFILE_ZIP_TYPE)
                outfile = gsf_outfile_zip_new (dest, &error);
-               break;
-       default:
+       else
                g_assert_not_reached ();
-       }
 
        if (error) {
                show_error (filename, error);
@@ -562,9 +553,9 @@ main (int argc, char **argv)
        if (strcmp (cmd, "listprops") == 0)
                return gsf_list_props (argc - 2, argv + 2);
        if (strcmp (cmd, "createole") == 0)
-               return gsf_create (argc - 2, argv + 2, GSF_OUTFILE_TYPE_MSOLE);
+               return gsf_create (argc - 2, argv + 2, GSF_OUTFILE_MSOLE_TYPE);
        if (strcmp (cmd, "createzip") == 0)
-               return gsf_create (argc - 2, argv + 2, GSF_OUTFILE_TYPE_ZIP);
+               return gsf_create (argc - 2, argv + 2, GSF_OUTFILE_ZIP_TYPE);
 
        g_printerr (_("Run '%s help' to see a list of subcommands.\n"), me);
        return 1;


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