From f9ce7a571ddbe124bb93bcfd3388e2cd4d77ec06 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 2 May 2006 07:03:52 +0000 Subject: [PATCH] * Add a unit test for globlist_match(). --- debian/changelog | 3 ++- debian/rules | 1 + t/globlist_match.t | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 t/globlist_match.t diff --git a/debian/changelog b/debian/changelog index 192b49dae..1b6e23ced 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,8 +26,9 @@ ikiwiki (1.1) UNRELEASED; urgency=low * Removed backlinks page, which it turns out nothing used. * Split off an IkiWiki.pm out of ikiwiki and have all the other modules use it, this will allow for adding a unit test suite. + * Add a unit test for globlist_match(). - -- Joey Hess Tue, 2 May 2006 02:51:06 -0400 + -- Joey Hess Tue, 2 May 2006 03:03:21 -0400 ikiwiki (1.0) unstable; urgency=low diff --git a/debian/rules b/debian/rules index ac3b328a6..df8390f94 100755 --- a/debian/rules +++ b/debian/rules @@ -5,6 +5,7 @@ build-stamp: dh_testdir perl Makefile.PL $(MAKE) + $(MAKE) test touch build-stamp clean: diff --git a/t/globlist_match.t b/t/globlist_match.t new file mode 100755 index 000000000..3d196e09c --- /dev/null +++ b/t/globlist_match.t @@ -0,0 +1,16 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 11; + +BEGIN { use_ok("IkiWiki"); } +ok(IkiWiki::globlist_match("foo", "*")); +ok(IkiWiki::globlist_match("foo", "f?? !foz")); +ok(! IkiWiki::globlist_match("foo", "f?? !foo")); +ok(! IkiWiki::globlist_match("foo", "* !foo")); +ok(! IkiWiki::globlist_match("foo", "foo !foo")); +ok(IkiWiki::globlist_match("page", "?ag?")); +ok(! IkiWiki::globlist_match("page", "?a?g?")); +ok(! IkiWiki::globlist_match("foo.png", "* !*.*")); +ok(IkiWiki::globlist_match("foo.png", "*.*")); +ok(! IkiWiki::globlist_match("foo", "*.*"));