[gtk-doc] tests: add a trivial unit test for gtkdoc-common
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] tests: add a trivial unit test for gtkdoc-common
- Date: Tue, 16 Jun 2015 08:10:04 +0000 (UTC)
commit 818438cfb6d72ef8260ca2f00c31efbf532f8f9e
Author: Stefan Sauer <ensonic users sf net>
Date: Mon Jun 15 05:43:24 2015 +0200
tests: add a trivial unit test for gtkdoc-common
We need to get away from only running integration tests. This is the boilerplate
for testing module code.
tests/Makefile.am | 4 +++-
tests/gtkdoc-common.t | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dc7cacd..da4ba8f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,7 +4,9 @@ SUBDIRS = gobject bugs annotations fail empty .
if BUILD_TESTS
-TESTS = tools.sh gobject.sh bugs.sh annotations.sh fail.sh empty.sh sanity.sh
+TESTS = \
+ gtkdoc-common.t \
+ tools.sh gobject.sh bugs.sh annotations.sh fail.sh empty.sh sanity.sh
TESTS_ENVIRONMENT = \
BUILDDIR=$(abs_builddir) \
SRCDIR=$(abs_srcdir) \
diff --git a/tests/gtkdoc-common.t b/tests/gtkdoc-common.t
new file mode 100755
index 0000000..35a706e
--- /dev/null
+++ b/tests/gtkdoc-common.t
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+# -*- cperl -*-
+#
+# gtk-doc - GTK DocBook documentation generator.
+# Copyright (C) 2015 Stefan Sauer
+#
+# 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 program 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+use diagnostics;
+use warnings;
+use strict;
+use Test::More;
+
+require_ok ("gtkdoc-common.pl");
+
+subtest 'CreateValidSGMLID' => sub {
+ is(CreateValidSGMLID('x'), 'x', 'already valid id is keept');
+ is(CreateValidSGMLID('x_ y'), 'x--y', '\'_\' and \' \' are converted to \'-\'');
+ is(CreateValidSGMLID('x,;y'), 'xy', '\',\' and \';\' are dropped');
+};
+
+done_testing();
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]