[gnumeric] Tests: make sure glade files can be parsed.



commit 9a60b5e41819d7b2c76c7181efc0a5962ea9a320
Author: Morten Welinder <terra gnome org>
Date:   Tue Aug 18 13:46:49 2009 -0400

    Tests: make sure glade files can be parsed.

 test/t8104-glade-parsing.pl |   11 +++++++
 tools/ChangeLog             |    4 +++
 tools/Makefile.am           |    6 +++-
 tools/check-glade-parsing   |   62 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 82 insertions(+), 1 deletions(-)
---
diff --git a/test/t8104-glade-parsing.pl b/test/t8104-glade-parsing.pl
new file mode 100755
index 0000000..909a010
--- /dev/null
+++ b/test/t8104-glade-parsing.pl
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+&message ("Check that glade files parse.");
+my $checker = "tools/check-glade-parsing";
+&GnumericTest::report_skip ("Missing tester") unless -r "$topsrc/$checker";
+&test_command ("cd $topsrc && $PERL $checker", sub { /^$/ });
diff --git a/tools/ChangeLog b/tools/ChangeLog
index b9eb07f..d5560aa 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-18  Morten Welinder  <terra gnome org>
+
+	* check-glade-parsing: New checker.
+
 2009-08-15  Morten Welinder <terra gnome org>
 
 	* Release 1.9.10
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e9c1891..f12dc13 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,3 +1,7 @@
 SUBDIRS = win32
 
-EXTRA_DIST = dumpdef.pl check-gfrees check-gtk-includes check-null-false-returns
+EXTRA_DIST = dumpdef.pl \
+	check-gfrees \
+	check-gtk-includes \
+	check-null-false-returns \
+	check-glade-parsing
diff --git a/tools/check-glade-parsing b/tools/check-glade-parsing
new file mode 100755
index 0000000..c7d26c6
--- /dev/null
+++ b/tools/check-glade-parsing
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -w
+#
+#  Gnumeric
+#
+#  Copyright (C) 2009 Morten Welinder.
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License as
+#  published by the Free Software Foundation; either version 2 of the
+#  License, or (at your option) any later version.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this library; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#  Author: Morten Welinder <terra gnome org>
+
+use strict;
+use XML::Parser;
+
+my $exitcode = 0;
+
+die "$0: must be run from top-level directory.\n"
+    unless -r "configure.in" && -r 'ChangeLog';
+
+my %exceptions = ();
+
+my @files;
+{
+    local (*FIND);
+    open (*FIND, "find . '(' -name \*.glade -type f -print ')' -o '(' -type d '(' -name CVS -o -name intl -o -name macros ')' -prune ')' |")
+	or die "$0: cannot execute find: $!\n";
+    foreach my $filename (<FIND>) {
+	chomp $filename;
+	$filename =~ s|^\./||;
+	next if $exceptions{$filename};
+	push @files, $filename;
+    }
+    close (*FIND);
+}
+
+
+{
+    my $parser = new XML::Parser ('Style' => 'Tree');
+  FILE:
+    foreach my $filename (@files) {
+	eval {
+	    my $tree = $parser->parsefile ($filename);
+	};
+	if ($@) {
+	    print STDERR "File $filename doesn't parse: $ \n";
+	    $exitcode = 1;
+	}
+    }
+}
+
+exit $exitcode;



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