From: Jarkko Hietaniemi Date: Fri, 11 May 2001 13:56:16 +0000 (+0000) Subject: Make the test to cleanup the test directory tree X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c80f55d1ea34dba13189e54d4f4e9bce7de39357;p=p5sagit%2Fp5-mst-13.2.git Make the test to cleanup the test directory tree both before and after the testing so that we always have a clean slate to work with. p4raw-id: //depot/perl@10084 --- diff --git a/t/lib/filefind.t b/t/lib/filefind.t index 362c1eb..de322f8 100755 --- a/t/lib/filefind.t +++ b/t/lib/filefind.t @@ -14,24 +14,35 @@ else { print "1..61\n"; } use File::Find; +cleanup(); + find(sub { print "ok 1\n" if $_ eq 'filefind.t'; }, "."); finddepth(sub { print "ok 2\n" if $_ eq 'filefind.t'; }, "."); - my $case = 2; my $FastFileTests_OK = 0; +sub cleanup { + if (-d 'for_find') { + chdir('for_find'); + } + if (-d 'fa') { + unlink 'fa/fa_ord', 'fa/fsl', 'fa/faa/faa_ord', + 'fa/fab/fab_ord', 'fa/fab/faba/faba_ord', + 'fb/fb_ord', 'fb/fba/fba_ord'; + rmdir 'fa/faa'; + rmdir 'fa/fab/faba'; + rmdir 'fa/fab'; + rmdir 'fa'; + rmdir 'fb/fba'; + rmdir 'fb'; + chdir '..'; + rmdir 'for_find'; + } +} + END { - unlink 'fa/fa_ord','fa/fsl','fa/faa/faa_ord', - 'fa/fab/fab_ord','fa/fab/faba/faba_ord','fb/fb_ord','fb/fba/fba_ord'; - rmdir 'fa/faa'; - rmdir 'fa/fab/faba'; - rmdir 'fa/fab'; - rmdir 'fa'; - rmdir 'fb/fba'; - rmdir 'fb'; - chdir '..'; - rmdir 'for_find'; + cleanup(); } sub Check($) {