summaryrefslogtreecommitdiff
path: root/T.pm
diff options
context:
space:
mode:
Diffstat (limited to 'T.pm')
-rw-r--r--T.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/T.pm b/T.pm
new file mode 100644
index 0000000..4178fd8
--- /dev/null
+++ b/T.pm
@@ -0,0 +1,27 @@
1package T;
2use strict;
3use warnings;
4use Cwd;
5use Test::More;
6use File::Copy::Recursive qw(dircopy);
7use File::Path qw(remove_tree);
8use Exporter;
9our @ISA = qw(Exporter);
10our @EXPORT = qw(system_ok);
11
12my $root = Cwd::cwd;
13$ENV{PATH} = "$root:$ENV{PATH}";
14$ENV{DH_AUTOSCRIPTDIR} = $root;
15
16die '$0 does not match expected format'
17 unless ($0 =~ m#t/([0-9]+)\.t#);
18my $number = $1;
19my $srcdir = (-d "t/base/${number}") ? "t/base/${number}" : "t/base/default";
20my $testdir = "t/${number}";
21remove_tree($testdir);
22dircopy($srcdir, $testdir);
23chdir($testdir);
24
25sub system_ok { ok(system(@_) == 0, "external command @_");}
26
271;