In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a5c2649359e39faef8af6f801a2443a7a2d47008?hp=e41cc779424eaf419bea11fb7535e356b1113698>
- Log ----------------------------------------------------------------- commit a5c2649359e39faef8af6f801a2443a7a2d47008 Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Jul 27 16:50:38 2009 +0200 Add support for new flag D in embed.fnc (deprecated) M embed.fnc M embed.pl commit 304efdcbf5a203c3e0f6c6f0db51fdcdf250aca1 Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Jul 27 16:03:21 2009 +0200 Add core test boilerplates (this is not a dual-life module) M lib/FileCache/t/01open.t M lib/FileCache/t/02maxopen.t M lib/FileCache/t/03append.t M lib/FileCache/t/04twoarg.t M lib/FileCache/t/05override.t M lib/FileCache/t/06export.t M lib/FileCache/t/07noimport.t commit 8e2e2108bd3e781e0030bedb33fdf9102a8de1c7 Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Jul 27 15:48:21 2009 +0200 Add core test boilerplate to some base.pm tests M lib/base/t/compile-time.t M lib/base/t/fields-5.6.0.t M lib/base/t/fields-5.8.0.t commit c5836baf9b57063ff2623ef7930432d0b26de3bb Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Jul 27 15:31:54 2009 +0200 Make test pass with miniperl miniperl can't load Tie::RefHash at the moment. M t/op/smartmatch.t commit c1d4704a2597260c95ce909e7891ef98aab05e8e Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Jul 27 15:21:20 2009 +0200 Make test pass with miniperl (no need to call overload::StrVal on objects that don't overload "") M t/op/filetest.t commit 0214bff6a3027ee423f9b2f01120bedb569584bd Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Jul 27 14:55:38 2009 +0200 Replace Test::More by test.pl M t/io/perlio.t M t/io/perlio_leaks.t M t/io/perlio_open.t M t/op/re.t M t/op/reg_fold.t M t/op/reg_posixcc.t M t/op/studytied.t ----------------------------------------------------------------------- Summary of changes: embed.fnc | 1 + embed.pl | 3 +++ lib/FileCache/t/01open.t | 8 ++++++++ lib/FileCache/t/02maxopen.t | 8 ++++++++ lib/FileCache/t/03append.t | 8 ++++++++ lib/FileCache/t/04twoarg.t | 14 ++++++++------ lib/FileCache/t/05override.t | 14 ++++++++------ lib/FileCache/t/06export.t | 12 +++++++----- lib/FileCache/t/07noimport.t | 6 ++++-- lib/base/t/compile-time.t | 7 +++++++ lib/base/t/fields-5.6.0.t | 7 +++++++ lib/base/t/fields-5.8.0.t | 6 ++++++ t/io/perlio.t | 3 ++- t/io/perlio_leaks.t | 12 +++++++++--- t/io/perlio_open.t | 3 ++- t/op/filetest.t | 7 ++++--- t/op/re.t | 8 ++++---- t/op/reg_fold.t | 4 ++-- t/op/reg_posixcc.t | 6 ++++-- t/op/smartmatch.t | 24 ++++++++++++++++-------- t/op/studytied.t | 3 ++- 21 files changed, 120 insertions(+), 44 deletions(-) diff --git a/embed.fnc b/embed.fnc index aed661b..f727f00 100644 --- a/embed.fnc +++ b/embed.fnc @@ -11,6 +11,7 @@ : m Implemented as a macro - no export, no : proto, no #define : d function has documentation with its source +: D function is deprecated : s static function, should have an S_ prefix in : source file; for macros (m), suffix the usage : example with a semicolon diff --git a/embed.pl b/embed.pl index 50da232..9c55cb4 100755 --- a/embed.pl +++ b/embed.pl @@ -253,6 +253,9 @@ sub write_protos { if ( $flags =~ /r/ ) { push @attrs, "__attribute__noreturn__"; } + if ( $flags =~ /D/ ) { + push @attrs, "__attribute__deprecated__"; + } if ( $is_malloc ) { push @attrs, "__attribute__malloc__"; } 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'; diff --git a/lib/base/t/compile-time.t b/lib/base/t/compile-time.t index 2be51f9..f7ffd1f 100644 --- a/lib/base/t/compile-time.t +++ b/lib/base/t/compile-time.t @@ -1,5 +1,12 @@ #!/usr/bin/perl -w +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} + use strict; use Test::More tests => 3; diff --git a/lib/base/t/fields-5.6.0.t b/lib/base/t/fields-5.6.0.t index 93bca34..819c335 100644 --- a/lib/base/t/fields-5.6.0.t +++ b/lib/base/t/fields-5.6.0.t @@ -7,6 +7,13 @@ if( $] >= 5.009 ) { exit; } +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} + use strict; use vars qw($Total_tests); diff --git a/lib/base/t/fields-5.8.0.t b/lib/base/t/fields-5.8.0.t index 2da1412..af39d0b 100644 --- a/lib/base/t/fields-5.8.0.t +++ b/lib/base/t/fields-5.8.0.t @@ -7,6 +7,12 @@ if( $] >= 5.009 ) { exit; } +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = qw(../lib); + } +} my $w; diff --git a/t/io/perlio.t b/t/io/perlio.t index c1eebec..c5f236d 100644 --- a/t/io/perlio.t +++ b/t/io/perlio.t @@ -6,9 +6,10 @@ BEGIN { print "1..0 # Skip: PerlIO not used\n"; exit 0; } + require './test.pl'; } -use Test::More tests => 39; +plan tests => 39; use_ok('PerlIO'); diff --git a/t/io/perlio_leaks.t b/t/io/perlio_leaks.t index 6bb6369..a7cdf28 100644 --- a/t/io/perlio_leaks.t +++ b/t/io/perlio_leaks.t @@ -1,9 +1,15 @@ #!perl # ioleaks.t +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; +} + use strict; use warnings; -use Test::More 'no_plan'; +plan 'no_plan'; # :unix -> not ok # :stdio -> not ok @@ -15,9 +21,9 @@ TODO: { my $base_fd = do{ open my $in, '<', $0 or die $!; fileno $in }; for(1 .. 3){ - local $TODO; + local $::TODO; if ($_ > 1 && $layer =~ /^:(unix|stdio)$/) { - $TODO = "[perl #56644] PerlIO resource leaks on open() and then :pop in :unix and :stdio" + $::TODO = "[perl #56644] PerlIO resource leaks on open() and then :pop in :unix and :stdio" } open my $fh, "<$layer", $0 or die $!; diff --git a/t/io/perlio_open.t b/t/io/perlio_open.t index e8e10fb..5f6a65c 100644 --- a/t/io/perlio_open.t +++ b/t/io/perlio_open.t @@ -16,12 +16,13 @@ BEGIN { print "1..0 # Skip: no Fcntl (how did you get this far?)\n"; exit 0; } + require './test.pl'; } use strict; use warnings; -use Test::More tests => 6; +plan tests => 6; use Fcntl qw(:seek); diff --git a/t/op/filetest.t b/t/op/filetest.t index c46bdc1..0d4f7c7 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -101,8 +101,9 @@ my $over; package OverFtest; use overload + fallback => 1, -X => sub { - $over = [overload::StrVal($_[0]), $_[1]]; + $over = [qq($_[0]), $_[1]]; "-$_[1]"; }; } @@ -131,11 +132,11 @@ my $over; } my $ft = bless [], "OverFtest"; -my $ftstr = overload::StrVal($ft); +my $ftstr = qq($ft); my $str = bless [], "OverString"; my $both = bless [], "OverBoth"; my $neither = bless [], "OverNeither"; -my $nstr = overload::StrVal($neither); +my $nstr = qq($neither); open my $gv, "<", "TEST"; bless $gv, "OverString"; diff --git a/t/op/re.t b/t/op/re.t index d098bdc..8c1c1f8 100644 --- a/t/op/re.t +++ b/t/op/re.t @@ -1,14 +1,14 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; } use strict; use warnings; -use Test::More; # test count at bottom of file use re qw(is_regexp regexp_pattern regname regnames regnames_count); { @@ -42,5 +42,5 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){ is(regnames_count(),3); } # New tests above this line, don't forget to update the test count below! -use Test::More tests => 14; +BEGIN { plan tests => 14 } # No tests here! diff --git a/t/op/reg_fold.t b/t/op/reg_fold.t index 3126dfc..2514452 100644 --- a/t/op/reg_fold.t +++ b/t/op/reg_fold.t @@ -3,11 +3,11 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + require './test.pl'; } use strict; use warnings; -use Test::More; my $count=1; my @tests; @@ -32,7 +32,7 @@ while (<$fh>) { my $t=($cpv > 256 || $str=~/^do/) ? "unicode" : "latin"; push @tests, qq[ok($expr,'$chr=~/@fc/ix - $comment ($t string)')]; - $tests[-1]="TODO: { local \$TODO='[13:41] <BinGOs> cue *It is all Greek to me* joke.';\n$tests[-1] }" + $tests[-1]="TODO: { local \$::TODO='[13:41] <BinGOs> cue *It is all Greek to me* joke.';\n$tests[-1] }" if $cp eq '0390' or $cp eq '03B0'; $count++; } diff --git a/t/op/reg_posixcc.t b/t/op/reg_posixcc.t index f6391ef..df12063 100644 --- a/t/op/reg_posixcc.t +++ b/t/op/reg_posixcc.t @@ -3,11 +3,13 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + require './test.pl'; } use strict; use warnings; -use Test::More 'no_plan'; # otherwise it would 38401 tests, which is, uh, a lot. :-) +plan "no_plan"; + my @pats=( "\\w", "\\W", @@ -40,7 +42,7 @@ my @pats=( "[:blank:]", "[:^blank:]" ); if (not $ENV{REAL_POSIX_CC}) { - $TODO = "Only works under PERL_LEGACY_UNICODE_CHARCLASS_MAPPINGS = 0"; + $::TODO = "Only works under PERL_LEGACY_UNICODE_CHARCLASS_MAPPINGS = 0"; } sub rangify { diff --git a/t/op/smartmatch.t b/t/op/smartmatch.t index cb0e656..33836b3 100644 --- a/t/op/smartmatch.t +++ b/t/op/smartmatch.t @@ -11,7 +11,7 @@ no warnings 'uninitialized'; use Tie::Array; use Tie::Hash; -use Tie::RefHash; +use if !$ENV{PERL_CORE_MINITEST}, "Tie::RefHash"; # Predeclare vars used in the tests: my @empty; @@ -61,8 +61,11 @@ our $ov_obj_2 = Test::Object::WithOverload->new("object"); our $obj = Test::Object::NoOverload->new; our $str_obj = Test::Object::StringOverload->new; -tie my %refh, 'Tie::RefHash'; -$refh{$ov_obj} = 1; +my %refh; +if (!$ENV{PERL_CORE_MINITEST}) { + tie %refh, 'Tie::RefHash'; + $refh{$ov_obj} = 1; +} my @keyandmore = qw(key and more); my @fooormore = qw(foo or more); @@ -73,6 +76,7 @@ my %fooormore = map { $_ => 0 } @fooormore; plan tests => 322; while (<DATA>) { + SKIP: { next if /^#/ || !/\S/; chomp; my ($yn, $left, $right, $note) = split /\t+/; @@ -88,6 +92,9 @@ while (<DATA>) { if ($note =~ /NOWARNINGS/) { $res = eval "no warnings; $tstr"; } + elsif ($note =~ /MINISKIP/ && $ENV{PERL_CORE_MINITEST}) { + skip("Doesn't work with miniperl", $yn =~ /=/ ? 2 : 1); + } else { $res = eval $tstr; } @@ -111,6 +118,7 @@ while (<DATA>) { $tstr = "$right ~~ $left"; goto test_again; } + } } sub foo {} @@ -302,11 +310,11 @@ __DATA__ = %hash %tied_hash %tied_hash %tied_hash != {"a"=>"b"} %tied_hash - $ov_obj %refh -! "$ov_obj" %refh - [$ov_obj] %refh -! ["$ov_obj"] %refh - %refh %refh + $ov_obj %refh MINISKIP +! "$ov_obj" %refh MINISKIP + [$ov_obj] %refh MINISKIP +! ["$ov_obj"] %refh MINISKIP + %refh %refh MINISKIP # - an array ref # (since this is symmetrical, tests as well hash~~array) diff --git a/t/op/studytied.t b/t/op/studytied.t index f56cc17..288bcd7 100644 --- a/t/op/studytied.t +++ b/t/op/studytied.t @@ -3,12 +3,13 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + require './test.pl'; } use strict; use warnings; -use Test::More tests => 14; +plan tests => 14; { package J; -- Perl5 Master Repository
