From d3bd7816b4b6057e5616c567818ac48c7bfa9028 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 6 Mar 2011 14:40:32 -0400 Subject: [PATCH] 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. --- unit-tests/run-tests.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 unit-tests/run-tests.pl 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; -- 2.26.2