* Add a unit test for globlist_match().
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 2 May 2006 07:03:52 +0000 (07:03 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 2 May 2006 07:03:52 +0000 (07:03 +0000)
debian/changelog
debian/rules
t/globlist_match.t [new file with mode: 0755]

index 192b49dae01eebc5b0236e0bdd2e419b828e7976..1b6e23ced14f8f4784b37af573e311fcb45f452c 100644 (file)
@@ -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 <joeyh@debian.org>  Tue,  2 May 2006 02:51:06 -0400
+ -- Joey Hess <joeyh@debian.org>  Tue,  2 May 2006 03:03:21 -0400
 
 ikiwiki (1.0) unstable; urgency=low
 
index ac3b328a69f63488bc95a48a8974caeaaecbc01f..df8390f9426cdfeff1d63ec8e6a7295eb9743761 100755 (executable)
@@ -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 (executable)
index 0000000..3d196e0
--- /dev/null
@@ -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", "*.*"));