From: Stephen McCamant Date: Tue, 28 Dec 2004 13:49:19 +0000 (-0800) Subject: Cleanup ext/B tests for -w and to run separately X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5638aaacc9150fc0f24c4cbd2aba01385e12f1da;p=p5sagit%2Fp5-mst-13.2.git Cleanup ext/B tests for -w and to run separately Message-ID: <16849.54495.424654.896889@apocalypse.OCF.Berkeley.EDU> p4raw-id: //depot/perl@23691 --- diff --git a/ext/B/B/Terse.pm b/ext/B/B/Terse.pm index 8d295cd..9cf3bf7 100644 --- a/ext/B/B/Terse.pm +++ b/ext/B/B/Terse.pm @@ -51,14 +51,14 @@ sub B::SV::terse { } sub B::NULL::terse { - my ($sv, $level) = @_; + my ($sv, $level) = (@_, 0); my $s = indent($level) . sprintf "%s (0x%lx)", class($sv), $$sv; print "$s\n" unless defined wantarray; $s; } sub B::SPECIAL::terse { - my ($sv, $level) = @_; + my ($sv, $level) = (@_, 0); my $s = indent($level) . sprintf( "%s #%d %s", class($sv), $$sv, $specialsv_name[$$sv]); print "$s\n" unless defined wantarray; diff --git a/ext/B/t/asmdata.t b/ext/B/t/asmdata.t index b787ee9..4e03f23 100644 --- a/ext/B/t/asmdata.t +++ b/ext/B/t/asmdata.t @@ -1,8 +1,12 @@ #!./perl -Tw BEGIN { - chdir 't'; - @INC = '../lib'; + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; diff --git a/ext/B/t/b.t b/ext/B/t/b.t index 0d2e8bc..70f4f59 100755 --- a/ext/B/t/b.t +++ b/ext/B/t/b.t @@ -1,12 +1,16 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - if ($^O eq 'MacOS') { - @INC = qw(: ::lib ::macos:lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + if ($^O eq 'MacOS') { + @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '.'; + push @INC, '../lib'; + } } else { - @INC = '.'; - push @INC, '../lib'; + unshift @INC, 't'; } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ diff --git a/ext/B/t/bblock.t b/ext/B/t/bblock.t index f8866fc..4979ea5 100644 --- a/ext/B/t/bblock.t +++ b/ext/B/t/bblock.t @@ -1,8 +1,12 @@ #!./perl -Tw BEGIN { - chdir 't'; - @INC = '../lib'; + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; diff --git a/ext/B/t/bytecode.t b/ext/B/t/bytecode.t index 831dae8..12450b0 100644 --- a/ext/B/t/bytecode.t +++ b/ext/B/t/bytecode.t @@ -7,8 +7,13 @@ BEGIN { print "1..0 # skip - Bytecode/ByteLoader doesn't work on VMS\n"; exit 0; } - chdir 't' if -d 't'; - @INC = qw(../lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } use Config; if (($Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -18,7 +23,7 @@ BEGIN { print "1..0 # skip - no COW for now\n"; exit 0; } - require './test.pl'; # for run_perl() + require 'test.pl'; # for run_perl() } use strict; @@ -114,6 +119,9 @@ my $l = 3; $x = sub { print $l }; &$x my $i = 1; my $foo = sub {$i = shift if @_}; &$foo(3); +print 'ok'; +>>>> +ok ############################################################ $x="Cannot use"; print index $x, "Can" >>>> @@ -127,7 +135,10 @@ BEGIN { %h=(1=>2,3=>4) } print $h{3} >>>> 4 ############################################################ -open our $T,"a" +open our $T,"a"; +print 'ok'; +>>>> +ok ############################################################ print __DATA__ diff --git a/ext/B/t/concise.t b/ext/B/t/concise.t index 16c5612..1a25112 100644 --- a/ext/B/t/concise.t +++ b/ext/B/t/concise.t @@ -1,14 +1,19 @@ #!./perl BEGIN { - chdir 't'; - @INC = '../lib'; + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } plan tests => 142; @@ -119,6 +124,7 @@ like ($@, qr/expecting 3 style-format args/, #### for content with doc'd options +our($a, $b); my $func = sub{ $a = $b+42 }; # canonical example asub SKIP: { @@ -246,7 +252,7 @@ SKIP: { } my %save = %combos; - my %combos; # outputs for $mode=any($order) and any($style) + %combos = (); # outputs for $mode=any($order) and any($style) # add more samples with switching modes & sticky styles for $style (@styles) { @@ -292,7 +298,7 @@ SKIP: { #now do double crosschecks: commutativity across stick / nostick - my %combos = (%combos, %save); + %combos = (%combos, %save); # test commutativity of flags, ie that AB == BA for $mode (@modes) { diff --git a/ext/B/t/debug.t b/ext/B/t/debug.t index 2fe0044..0e502ee 100755 --- a/ext/B/t/debug.t +++ b/ext/B/t/debug.t @@ -1,12 +1,16 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - if ($^O eq 'MacOS') { - @INC = qw(: ::lib ::macos:lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + if ($^O eq 'MacOS') { + @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '.'; + push @INC, '../lib'; + } } else { - @INC = '.'; - push @INC, '../lib'; + unshift @INC, 't'; } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index 033bdd5..cf6843a 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -1,12 +1,16 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - if ($^O eq 'MacOS') { - @INC = qw(: ::lib ::macos:lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + if ($^O eq 'MacOS') { + @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '.'; + push @INC, '../lib'; + } } else { - @INC = '.'; - push @INC, '../lib'; + unshift @INC, 't'; } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ diff --git a/ext/B/t/f_map.t b/ext/B/t/f_map.t index 449d730..851428d 100644 --- a/ext/B/t/f_map.t +++ b/ext/B/t/f_map.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir q(t); - @INC = qw(../lib ../ext/B/t); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -21,7 +26,7 @@ BEGIN { print "1..0 # Skip -- TODO - provide golden result regexps for 5.8\n"; exit 0; } - require q(./test.pl); + require q(test.pl); } use OptreeCheck; plan tests => 9; diff --git a/ext/B/t/f_sort.t b/ext/B/t/f_sort.t index 7d60173..729b244 100644 --- a/ext/B/t/f_sort.t +++ b/ext/B/t/f_sort.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir q(t); - @INC = qw(../lib ../ext/B/t); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -21,7 +26,7 @@ BEGIN { print "1..0 # Skip -- TODO - provide golden result regexps for 5.8\n"; exit 0; } - require q(./test.pl); + require q(test.pl); } use OptreeCheck; plan tests => 20; diff --git a/ext/B/t/lint.t b/ext/B/t/lint.t index 2b49024..bd76216 100644 --- a/ext/B/t/lint.t +++ b/ext/B/t/lint.t @@ -1,14 +1,19 @@ #!./perl -w BEGIN { - chdir 't' if -d 't'; - @INC = qw(../lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } plan tests => 15; # adjust also number of skipped tests ! diff --git a/ext/B/t/o.t b/ext/B/t/o.t index b8b4349..2b84f39 100644 --- a/ext/B/t/o.t +++ b/ext/B/t/o.t @@ -1,8 +1,13 @@ #!./perl -w BEGIN { - chdir 't' if -d 't'; - @INC = ('../lib', 'lib', '.'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', 'lib', '../lib'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; diff --git a/ext/B/t/optree_check.t b/ext/B/t/optree_check.t index b91da13..af1dbab 100644 --- a/ext/B/t/optree_check.t +++ b/ext/B/t/optree_check.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir 't'; - @INC = ('../lib', '../ext/B/t'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -13,7 +18,7 @@ BEGIN { "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } use OptreeCheck; diff --git a/ext/B/t/optree_concise.t b/ext/B/t/optree_concise.t index d4d6d32..00a04cb 100644 --- a/ext/B/t/optree_concise.t +++ b/ext/B/t/optree_concise.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir 't'; - @INC = ('../lib', '../ext/B/t'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -13,7 +18,7 @@ BEGIN { "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } # import checkOptree(), and %gOpts (containing test state) diff --git a/ext/B/t/optree_samples.t b/ext/B/t/optree_samples.t index 576a890..13b0282 100644 --- a/ext/B/t/optree_samples.t +++ b/ext/B/t/optree_samples.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir 't'; - @INC = ('../lib', '../ext/B/t'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -17,7 +22,7 @@ BEGIN { print "1..0 # Skip -- TODO - provide golden result regexps for 5.8\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } use OptreeCheck; use Config; diff --git a/ext/B/t/optree_sort.t b/ext/B/t/optree_sort.t index 6b59f15..be7dc52 100644 --- a/ext/B/t/optree_sort.t +++ b/ext/B/t/optree_sort.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir 't'; - @INC = ('../lib', '../ext/B/t'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -13,7 +18,7 @@ BEGIN { "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } use OptreeCheck; use Config; diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t index 8b875aa..dda1adc 100644 --- a/ext/B/t/optree_specials.t +++ b/ext/B/t/optree_specials.t @@ -1,8 +1,13 @@ #!./perl BEGIN { - chdir 't'; - @INC = ('../lib', '../ext/B/t'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -13,7 +18,7 @@ BEGIN { "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } # import checkOptree(), and %gOpts (containing test state) diff --git a/ext/B/t/optree_varinit.t b/ext/B/t/optree_varinit.t index e7fd492..25260b8 100644 --- a/ext/B/t/optree_varinit.t +++ b/ext/B/t/optree_varinit.t @@ -1,8 +1,13 @@ #!perl BEGIN { - chdir 't'; - @INC = ('../lib', '../ext/B/t'); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib', '../ext/B/t'); + } else { + unshift @INC, 't'; + push @INC, "../../t"; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -13,7 +18,7 @@ BEGIN { "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } use OptreeCheck; use Config; diff --git a/ext/B/t/showlex.t b/ext/B/t/showlex.t index 9ac5288..3cb28da 100755 --- a/ext/B/t/showlex.t +++ b/ext/B/t/showlex.t @@ -1,18 +1,24 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - if ($^O eq 'MacOS') { - @INC = qw(: ::lib ::macos:lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + if ($^O eq 'MacOS') { + @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '.'; + push @INC, '../lib'; + } } else { - @INC = '../lib'; + unshift @INC, 't'; + push @INC, "../../t"; } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; exit 0; } - require './test.pl'; + require 'test.pl'; } $| = 1; diff --git a/ext/B/t/stash.t b/ext/B/t/stash.t index 873e484..8b44e8a 100755 --- a/ext/B/t/stash.t +++ b/ext/B/t/stash.t @@ -1,11 +1,16 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - if ($^O eq 'MacOS') { - @INC = qw(: ::lib ::macos:lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + if ($^O eq 'MacOS') { + @INC = qw(: ::lib ::macos:lib); + } else { + @INC = '.'; + push @INC, '../lib'; + } } else { - @INC = '../lib'; + unshift @INC, 't'; } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ diff --git a/ext/B/t/terse.t b/ext/B/t/terse.t index d8d0529..2df8eee 100644 --- a/ext/B/t/terse.t +++ b/ext/B/t/terse.t @@ -1,8 +1,12 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n"; @@ -50,8 +54,8 @@ foreach (@lines) { my $op = $1; next unless exists $ops{$op}; like( $_, $ops{$op}, "$op " ); - delete $ops{$op}; s/$ops{$op}//; + delete $ops{$op}; redo if $_; } } @@ -76,7 +80,7 @@ sub bar { $a = 1.234; # this is awful, but it gives a PMOP - my $boo = split('', $foo); + our @ary = split('', $foo); # PVOP, LOOP LOOP: for (1 .. 10) { diff --git a/ext/B/t/xref.t b/ext/B/t/xref.t index ade0154..450582b 100644 --- a/ext/B/t/xref.t +++ b/ext/B/t/xref.t @@ -1,8 +1,12 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = qw(../lib); + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } else { + unshift @INC, 't'; + } require Config; if (($Config::Config{'extensions'} !~ /\bB\b/) ){ print "1..0 # Skip -- Perl configured without B module\n";