X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FAutoSplit.t;h=36d33681d56b6cf6a44bafea7e4e950d28953d4f;hb=d9f30342f9de4793189d81b85a5e32057393e428;hp=8d764c1eef13011048d10a2f39f1fe6096b31c2b;hpb=d1be9408a3c14848d30728674452e191ba5fffaa;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/AutoSplit.t b/lib/AutoSplit.t index 8d764c1..36d3368 100644 --- a/lib/AutoSplit.t +++ b/lib/AutoSplit.t @@ -3,15 +3,19 @@ # AutoLoader.t runs before this test, so it seems safe to assume that it will # work. -my $incdir; -my $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS +my($incdir, $lib); BEGIN { chdir 't' if -d 't'; + if ($^O eq 'dos') { + print "1..0 # This test is not 8.3-aware.\n"; + exit 0; + } if ($^O eq 'MacOS') { $incdir = ":auto-$$"; - $lib = '-x -I::lib:'; # -x overcomes MPW $Config{startperl} anomaly + $lib = '-I::lib:'; } else { $incdir = "auto-$$"; + $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS } @INC = $incdir; push @INC, '../lib'; @@ -45,8 +49,9 @@ my @tests; close DATA; } -my $pathsep = $^O eq 'MSWin32' ? '\\' : '/'; - +my $pathsep = $^O eq 'MSWin32' ? '\\' : $^O eq 'MacOS' ? ':' : '/'; +my $endpathsep = $^O eq 'MacOS' ? ':' : ''; + sub split_a_file { my $contents = shift; my $file = $_[0]; @@ -72,7 +77,10 @@ my $dir = File::Spec->catdir($incdir, 'auto'); if ($^O eq 'VMS') { $dir = VMS::Filespec::unixify($dir); $dir =~ s/\/$//; +} elsif ($^O eq 'MacOS') { + $dir =~ s/:$//; } + foreach (@tests) { my $module = 'A' . $i . '_' . $$ . 'splittest'; my $file = File::Spec->catfile($incdir,"$module.pm"); @@ -80,6 +88,7 @@ foreach (@tests) { s/\*DIR\*/$dir/gm; s/\*MOD\*/$module/gm; s/\*PATHSEP\*/$pathsep/gm; + s/\*ENDPATHSEP\*/$endpathsep/gm; s#//#/#gm; # Build a hash for this test. my %args = /^\#\#\ ([^\n]*)\n # Key is on a line starting ## @@ -90,6 +99,8 @@ foreach (@tests) { foreach ($args{Name}, $args{Require}, $args{Extra}) { chomp $_ if defined $_; } + $args{Get} ||= ''; + my @extra_args = !defined $args{Extra} ? () : split /,/, $args{Extra}; my ($output, $body); if ($args{File}) { @@ -111,7 +122,7 @@ foreach (@tests) { } # test n+1 - is ($output, $args{Get}, "Output from autosplit()ing $args{Name}"); + is($output, $args{Get}, "Output from autosplit()ing $args{Name}"); if ($args{Files}) { $args{Files} =~ s!/!:!gs if $^O eq 'MacOS'; @@ -138,6 +149,7 @@ foreach (@tests) { } } if ($args{Require}) { + $args{Require} =~ s|/|:|gm if $^O eq 'MacOS'; my $com = 'require "' . File::Spec->catfile ('auto', $args{Require}) . '"'; $com =~ s{\\}{/}gm if ($^O eq 'MSWin32'); eval $com; @@ -217,11 +229,11 @@ sub test_a2 : locked { 1; } # And that was all it has. You were expected to manually inspect the output ## Get Warning: AutoSplit had to create top-level *DIR* unexpectedly. -AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) +AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*) *INC**PATHSEP**MOD*.pm: some names are not unique when truncated to 8 characters: - directory *DIR**PATHSEP**MOD*: + directory *DIR**PATHSEP**MOD**ENDPATHSEP*: testtesttesttest4_1.al, testtesttesttest4_2.al truncate to testtest - directory *DIR**PATHSEP*Yet*PATHSEP*Another*PATHSEP*AutoSplit: + directory *DIR**PATHSEP*Yet*PATHSEP*Another*PATHSEP*AutoSplit*ENDPATHSEP*: testtesttesttest4_1.al, testtesttesttest4_2.al truncate to testtest ## Files *DIR*/*MOD*/autosplit.ix @@ -277,7 +289,7 @@ missing use AutoLoader; (but don't skip) 1; __END__ ## Get -AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) +AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*) ## Require *MOD*/autosplit.ix ## Files @@ -289,10 +301,10 @@ Split prior to checking whether obsolete files get deleted use AutoLoader 'AUTOLOAD'; 1; __END__ -sub obsolete {my $a if 0; return $a++;} +sub obsolete {our $hidden_a; return $hidden_a++;} sub gonner {warn "This gonner function should never get called"} ## Get -AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) +AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*) ## Require *MOD*/autosplit.ix ## Files @@ -303,7 +315,7 @@ AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) is (&*MOD*::obsolete, 0); is (&*MOD*::obsolete, 1); ## Sleep -2 +4 ## SameAgain True, so don't scrub this directory. IIRC DOS FAT filesystems have only 2 second granularity. @@ -320,7 +332,7 @@ sub ghoul {"wail"}; sub zombie {"You didn't use fire."}; sub flying_pig {"Oink oink flap flap"}; ## Get -AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) +AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*) ## Require *MOD*/autosplit.ix ## Files @@ -334,7 +346,7 @@ AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) is (&*MOD*::skeleton, "bones", "skeleton"); eval {&*MOD*::gonner}; ok ($@ =~ m!^Can't locate auto/*MOD*/gonner.al in \@INC!, "Check &*MOD*::gonner is now a gonner") or print "# \$\@='$@'\n"; ## Sleep -2 +4 ## SameAgain True, so don't scrub this directory. ################################################################ @@ -349,7 +361,7 @@ __END__ sub ghost {"bump"}; sub wraith {9}; ## Get -AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) +AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*) ## Require *MOD*/autosplit.ix ## Files @@ -364,7 +376,7 @@ AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) is (&*MOD*::ghost, "bump"); is (&*MOD*::zombie, "You didn't use fire.", "Are our zombies undead?"); ## Sleep -2 +4 ## SameAgain True, so don't scrub this directory. ################################################################ @@ -386,7 +398,7 @@ Without the timestamp check make sure that nothing happens is (&*MOD*::ghoul, "wail", "still haunted"); is (&*MOD*::zombie, "You didn't use fire.", "Are our zombies still undead?"); ## Sleep -2 +4 ## SameAgain True, so don't scrub this directory. ################################################################ @@ -395,7 +407,7 @@ With the timestamp check make sure that things happen (stuff gets deleted) ## Extra 0, 1, 0 ## Get -AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*) +AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*) ## Require *MOD*/autosplit.ix ## Files