From: David Bremner Date: Sun, 6 Mar 2011 18:40:32 +0000 (-0400) Subject: add unit test harness. X-Git-Url: http://git.tremily.us/?p=monkeysphere-validation-agent.git;a=commitdiff_plain;h=d3bd7816b4b6057e5616c567818ac48c7bfa9028 add unit test harness. 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. --- diff --git a/unit-tests/run-tests.pl b/unit-tests/run-tests.pl new file mode 100644 index 0000000..e8305ce --- /dev/null +++ b/unit-tests/run-tests.pl @@ -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;