diff options
Diffstat (limited to 't/lib.pl')
-rw-r--r-- | t/lib.pl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/t/lib.pl b/t/lib.pl new file mode 100644 index 0000000..e1512c6 --- /dev/null +++ b/t/lib.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +# lib.pl is the file where database specific things should live, +# whereever possible. For example, you define certain constants +# here and the like. + +use strict; + +use File::Basename; +use File::Path; +use File::Spec; + +my $test_dir; +END { defined( $test_dir ) and rmtree $test_dir } + +sub test_dir +{ + unless( defined( $test_dir ) ) + { + $test_dir = File::Spec->rel2abs( File::Spec->curdir () ); + $test_dir = File::Spec->catdir ( $test_dir, "test_output_" . $$ ); + $test_dir = VMS::Filespec::unixify($test_dir) if $^O eq 'VMS'; + rmtree $test_dir; + mkpath $test_dir; + # There must be at least one directory in the test directory, + # and nothing guarantees that dot or dot-dot directories will exist. + mkpath ( File::Spec->catdir( $test_dir, '000_just_testing' ) ); + } + + return $test_dir; +} + +1; |