add unit test harness.
authorDavid Bremner <bremner@debian.org>
Sun, 6 Mar 2011 18:40:32 +0000 (14:40 -0400)
committerDavid Bremner <bremner@debian.org>
Sun, 6 Mar 2011 18:40:32 +0000 (14:40 -0400)
The file looks for any files under unit-tests ending in .t, and runs them.
You can use e.g. Test::Simple or Test::More to make such tests.

unit-tests/run-tests.pl [new file with mode: 0644]

diff --git a/unit-tests/run-tests.pl b/unit-tests/run-tests.pl
new file mode 100644 (file)
index 0000000..e8305ce
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+use strict;
+
+use TAP::Harness;
+use File::Find;
+use FindBin;
+my $BINDIR;
+BEGIN { $BINDIR = $FindBin::Bin; }
+
+
+my @tests;
+
+sub wanted {
+  push (@tests,$File::Find::name) if -f && m/.*\.t$/;
+}
+
+find(\&wanted, $BINDIR);
+
+print STDERR "found ",scalar(@tests)," tests\n";
+
+my $harness = TAP::Harness->new( { verbosity => 1,
+                                 lib => [ $BINDIR.'/..'] });
+
+$harness->runtests(@tests);
+
+1;