From: Rafael Garcia-Suarez Date: Mon, 27 Jul 2009 14:03:21 +0000 (+0200) Subject: Add core test boilerplates X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=304efdcbf5a203c3e0f6c6f0db51fdcdf250aca1;p=p5sagit%2Fp5-mst-13.2.git Add core test boilerplates (this is not a dual-life module) --- diff --git a/lib/FileCache/t/01open.t b/lib/FileCache/t/01open.t index 75da3b2..ee207dd 100644 --- a/lib/FileCache/t/01open.t +++ b/lib/FileCache/t/01open.t @@ -1,4 +1,12 @@ #!./perl + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} + use FileCache; use vars qw(@files); BEGIN { diff --git a/lib/FileCache/t/02maxopen.t b/lib/FileCache/t/02maxopen.t index 603edeb..2f737eb 100644 --- a/lib/FileCache/t/02maxopen.t +++ b/lib/FileCache/t/02maxopen.t @@ -1,4 +1,12 @@ #!./perl + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} + use FileCache maxopen=>2; use Test; use vars qw(@files); diff --git a/lib/FileCache/t/03append.t b/lib/FileCache/t/03append.t index a6ba6f3..5afc513 100644 --- a/lib/FileCache/t/03append.t +++ b/lib/FileCache/t/03append.t @@ -1,4 +1,12 @@ #!./perl + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} + use FileCache maxopen=>2; use vars qw(@files); BEGIN { diff --git a/lib/FileCache/t/04twoarg.t b/lib/FileCache/t/04twoarg.t index 66da971..40bae6d 100644 --- a/lib/FileCache/t/04twoarg.t +++ b/lib/FileCache/t/04twoarg.t @@ -1,12 +1,14 @@ #!./perl -BEGIN { - use FileCache; - chdir 't' if -d 't'; - #For tests within the perl distribution - @INC = '../lib' if -d '../lib'; - END; +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } } + +use FileCache; + END{ unlink('foo'); } diff --git a/lib/FileCache/t/05override.t b/lib/FileCache/t/05override.t index a807c25..b7b4083 100644 --- a/lib/FileCache/t/05override.t +++ b/lib/FileCache/t/05override.t @@ -1,12 +1,14 @@ #!./perl -BEGIN { - use FileCache; - chdir 't' if -d 't'; - #For tests within the perl distribution - @INC = '../lib' if -d '../lib'; - END; +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } } + +use FileCache; + END{ unlink("Foo_Bar"); } diff --git a/lib/FileCache/t/06export.t b/lib/FileCache/t/06export.t index 60f55a3..67d5996 100644 --- a/lib/FileCache/t/06export.t +++ b/lib/FileCache/t/06export.t @@ -1,11 +1,13 @@ #!./perl -BEGIN { - chdir 't' if -d 't'; - #For tests within the perl distribution - @INC = '../lib' if -d '../lib'; - END; +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} +BEGIN { # Functions exported by FileCache; @funcs = qw[cacheout cacheout_close]; $i = 0; diff --git a/lib/FileCache/t/07noimport.t b/lib/FileCache/t/07noimport.t index d2f926c..a6e024d 100644 --- a/lib/FileCache/t/07noimport.t +++ b/lib/FileCache/t/07noimport.t @@ -1,8 +1,10 @@ #!./perl -w BEGIN { - chdir 't'; - @INC = '../lib'; + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } } require './test.pl';