diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2009-10-12 18:24:50 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2009-10-12 18:24:50 +0000 |
commit | 7bed5fce775e8466f8c0c970eaeb5071d8a7718c (patch) | |
tree | c0c8e293312f13dfe8f57376c94f545c453ced38 /gnu/usr.bin/perl/t | |
parent | 4c85db8b5736693bd819a09987f0dc89a9f1c24d (diff) |
Merge in perl 5.10.1
Diffstat (limited to 'gnu/usr.bin/perl/t')
49 files changed, 161 insertions, 1435 deletions
diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/01use.t b/gnu/usr.bin/perl/t/Module_Pluggable/01use.t deleted file mode 100644 index be0b8481acf..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/01use.t +++ /dev/null @@ -1,9 +0,0 @@ -#!perl -w - -use strict; -use Test::More tests => 3; - -use_ok('Module::Pluggable'); -use_ok('Module::Pluggable::Object'); -use_ok('Devel::InnerPackage'); - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/02alsoworks.t b/gnu/usr.bin/perl/t/Module_Pluggable/02alsoworks.t deleted file mode 100644 index c7b00adbe2e..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/02alsoworks.t +++ /dev/null @@ -1,42 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 5; - -my $foo; -ok($foo = MyOtherTest->new()); - -my @plugins; -my @expected = qw(MyOtherTest::Plugin::Bar MyOtherTest::Plugin::Foo MyOtherTest::Plugin::Quux MyOtherTest::Plugin::Quux::Foo); -ok(@plugins = sort $foo->plugins); - - - -is_deeply(\@plugins, \@expected, "is deeply"); - -@plugins = (); - -ok(@plugins = sort MyOtherTest->plugins); - - - - -is_deeply(\@plugins, \@expected, "is deeply class"); - - - -package MyOtherTest; - -use strict; -use Module::Pluggable; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/02works.t b/gnu/usr.bin/perl/t/Module_Pluggable/02works.t deleted file mode 100644 index 6c39452ac8c..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/02works.t +++ /dev/null @@ -1,42 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 5; - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo); -ok(@plugins = sort $foo->plugins); - - - -is_deeply(\@plugins, \@expected, "is deeply"); - -@plugins = (); - -ok(@plugins = sort MyTest->plugins); - - - - -is_deeply(\@plugins, \@expected, "is deeply class"); - - - -package MyTest; - -use strict; -use Module::Pluggable; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/02works_taint.t b/gnu/usr.bin/perl/t/Module_Pluggable/02works_taint.t deleted file mode 100644 index 0e1baa3dc0f..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/02works_taint.t +++ /dev/null @@ -1,41 +0,0 @@ -#!perl -wT - -# NOTE: Module::Pluggable is going into core -# and CORE tests can't modify @INC under taint -# so this is a work around to make sure it -# still works under taint checking. - -use strict; -use Test::More tests => 5; - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(Module::Pluggable::Object); -ok(@plugins = sort $foo->plugins); - - -ok(grep {/Module::Pluggable::Object/} @plugins, "Contains Module::Pluggable::Object"); - -@plugins = (); - -ok(@plugins = sort MyTest->plugins); - -ok(grep {/Module::Pluggable::Object/} @plugins, "Contains Module::Pluggable::Object under class method"); - - - -package MyTest; - -use strict; -use Module::Pluggable search_path => 'Module::Pluggable'; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/03diffname.t b/gnu/usr.bin/perl/t/Module_Pluggable/03diffname.t deleted file mode 100644 index b4a881b6e8d..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/03diffname.t +++ /dev/null @@ -1,30 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo); -ok(@plugins = sort $foo->foo); -is_deeply(\@plugins, \@expected); - - - -package MyTest; - -use strict; -use Module::Pluggable ( sub_name => 'foo'); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/04acmedir.t b/gnu/usr.bin/perl/t/Module_Pluggable/04acmedir.t deleted file mode 100644 index 71544860b8d..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/04acmedir.t +++ /dev/null @@ -1,30 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(Acme::MyTest::Plugin::Foo); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable search_path => ["Acme::MyTest::Plugin"], search_dirs => [ "t/acme" ]; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/04acmedir_single.t b/gnu/usr.bin/perl/t/Module_Pluggable/04acmedir_single.t deleted file mode 100644 index e2abce9d4e8..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/04acmedir_single.t +++ /dev/null @@ -1,30 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(Acme::MyTest::Plugin::Foo); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable search_path => "Acme::MyTest::Plugin", search_dirs => "t/acme" ; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/04acmepath.t b/gnu/usr.bin/perl/t/Module_Pluggable/04acmepath.t deleted file mode 100644 index bb1b88b7b8b..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/04acmepath.t +++ /dev/null @@ -1,30 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(Acme::MyTest::Plugin::Foo); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable (search_path => ["Acme::MyTest::Plugin"]); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/04acmepath_single.t b/gnu/usr.bin/perl/t/Module_Pluggable/04acmepath_single.t deleted file mode 100644 index bf02854c223..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/04acmepath_single.t +++ /dev/null @@ -1,30 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(Acme::MyTest::Plugin::Foo); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable search_path => "Acme::MyTest::Plugin"; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/05postpath.t b/gnu/usr.bin/perl/t/Module_Pluggable/05postpath.t deleted file mode 100644 index be16010bbbc..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/05postpath.t +++ /dev/null @@ -1,31 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(MyTest::Extend::Plugin::Bar); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected); - - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"]); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/06multipath.t b/gnu/usr.bin/perl/t/Module_Pluggable/06multipath.t deleted file mode 100644 index 4c9a16b589d..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/06multipath.t +++ /dev/null @@ -1,33 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(Acme::MyTest::Plugin::Foo MyTest::Extend::Plugin::Bar); -ok(@plugins = sort $foo->plugins); - -is_deeply(\@plugins, \@expected); - - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use File::Spec::Functions qw(catdir); -use Module::Pluggable (search_path => ["MyTest::Extend::Plugin", "Acme::MyTest::Plugin"]); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/07instantiate.t b/gnu/usr.bin/perl/t/Module_Pluggable/07instantiate.t deleted file mode 100644 index befc15a8191..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/07instantiate.t +++ /dev/null @@ -1,40 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 6; - -my $foo; -ok($foo = MyTest->new()); - - - -my @plugins; -ok(@plugins = sort $foo->booga(nork => 'fark')); -is(ref $plugins[0],'MyTest::Extend::Plugin::Bar'); -is($plugins[0]->nork,'fark'); - - -@plugins = (); -eval { @plugins = $foo->wooga( nork => 'fark') }; -is($@, ''); -is(scalar(@plugins),0); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'booga', instantiate => 'new'); -use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'wooga', instantiate => 'nosomuchmethod'); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/08nothing.t b/gnu/usr.bin/perl/t/Module_Pluggable/08nothing.t deleted file mode 100644 index 78d1007923c..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/08nothing.t +++ /dev/null @@ -1,30 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 2; - - -my $foo; -ok($foo = MyTest->new()); - -my @expected = (); -my @plugins = sort $foo->plugins; -is_deeply(\@plugins, \@expected); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable (search_path => ["No::Such::Modules"]); -use base qw(Module::Pluggable); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/09require.t b/gnu/usr.bin/perl/t/Module_Pluggable/09require.t deleted file mode 100644 index 106e2c46dfa..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/09require.t +++ /dev/null @@ -1,29 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 2; - -my $t = MyTest->new(); - - -ok($t->plugins()); - -ok(keys %{MyTest::Plugin::Foo::}); - - -package MyTest; -use File::Spec::Functions qw(catdir); -use strict; -use Module::Pluggable (require => 1); -use base qw(Module::Pluggable); - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack.t b/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack.t deleted file mode 100644 index fc7a213052c..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack.t +++ /dev/null @@ -1,35 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 4; - - - -my $t = InnerTest->new(); - -my %plugins = map { $_ => 1 } $t->plugins; - -ok(keys %plugins, "Got some plugins"); -ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo"); -ok($plugins{'InnerTest::Plugin::Bar'}, "Got Bar - the inner package"); -ok($plugins{'InnerTest::Plugin::Quux'}, "Got Quux - the other inner package"); - - - -package InnerTest; -use strict; -use Module::Pluggable require => 1; -use base qw(Module::Pluggable); - - -sub new { - my $class = shift; - return bless {}, $class; - -} - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_inner.t b/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_inner.t deleted file mode 100644 index 55edcd9246a..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_inner.t +++ /dev/null @@ -1,34 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - - -my $t = InnerTest->new(); - -my %plugins = map { $_ => 1 } $t->plugins; - -ok(keys %plugins, "Got some plugins"); -ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo"); -ok($plugins{'InnerTest::Plugin::Bar'}, "Got Bar - the inner package"); - - - -package InnerTest; -use strict; -use Module::Pluggable inner => 1; -use base qw(Module::Pluggable); - - -sub new { - my $class = shift; - return bless {}, $class; - -} - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_noinner.t b/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_noinner.t deleted file mode 100644 index 5d40cd5cff3..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_noinner.t +++ /dev/null @@ -1,34 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - - -my $t = InnerTest->new(); - -my %plugins = map { $_ => 1 } $t->plugins; - -ok(keys %plugins, "Got some plugins"); -ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo"); -ok(!$plugins{'InnerTest::Plugin::Bar'}, "Didn't get Bar - the inner package"); - - - -package InnerTest; -use strict; -use Module::Pluggable require => 1, inner => 0; -use base qw(Module::Pluggable); - - -sub new { - my $class = shift; - return bless {}, $class; - -} - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_override.t b/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_override.t deleted file mode 100644 index 039b845267f..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/10innerpack_override.t +++ /dev/null @@ -1,34 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - - - -my $t = InnerTest->new(); - -my %plugins = map { $_ => 1 } $t->plugins; - -ok(keys %plugins, "Got some plugins"); -ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo"); -ok($plugins{'InnerTest::Plugin::Bar'}, "Got Bar - the inner package"); - - - -package InnerTest; -use strict; -use Module::Pluggable require => 0, inner => 1; -use base qw(Module::Pluggable); - - -sub new { - my $class = shift; - return bless {}, $class; - -} - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/11usetwice.t b/gnu/usr.bin/perl/t/Module_Pluggable/11usetwice.t deleted file mode 100644 index 0f6a1bae7a5..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/11usetwice.t +++ /dev/null @@ -1,44 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 3; - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(MyTest::Extend::Plugin::Bar MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo); - -push @plugins, $foo->plugins; -push @plugins, $foo->foo; - -@plugins = sort @plugins; -is_deeply(\@plugins, \@expected); - -@plugins = (); - -push @plugins, MyTest->plugins; -push @plugins, MyTest->foo; -@plugins = sort @plugins; -is_deeply(\@plugins, \@expected); - - - -package MyTest; - -use strict; -use Module::Pluggable; -use Module::Pluggable ( search_path => [ "MyTest::Extend::Plugin" ] , sub_name => 'foo' ); - - -sub new { - my $class = shift; - return bless {}, $class; - -} - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/12only.t b/gnu/usr.bin/perl/t/Module_Pluggable/12only.t deleted file mode 100644 index 6164c42ac97..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/12only.t +++ /dev/null @@ -1,64 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; - -{ - my $foo; - ok($foo = MyTest->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Foo); - ok(@plugins = sort $foo->plugins); - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTest->plugins); - is_deeply(\@plugins, \@expected); -} - -{ - my $foo; - ok($foo = MyTestSub->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Foo); - ok(@plugins = sort $foo->plugins); - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTestSub->plugins); - is_deeply(\@plugins, \@expected); -} - -package MyTest; - -use strict; -use Module::Pluggable only => "MyTest::Plugin::Foo"; - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -package MyTestSub; - -use strict; -use Module::Pluggable search_path => "MyTest::Plugin"; - - -sub new { - my $class = shift; - my $self = bless {}, $class; - - $self->only("MyTest::Plugin::Foo"); - - return $self; -} -1; diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/12onlyarray.t b/gnu/usr.bin/perl/t/Module_Pluggable/12onlyarray.t deleted file mode 100644 index 5ecc65435f1..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/12onlyarray.t +++ /dev/null @@ -1,65 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; - -{ - my $foo; - ok($foo = MyTest->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Foo); - ok(@plugins = sort $foo->plugins); - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTest->plugins); - is_deeply(\@plugins, \@expected); -} - -{ - my $foo; - ok($foo = MyTestSub->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Foo); - ok(@plugins = sort $foo->plugins); - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTestSub->plugins); - is_deeply(\@plugins, \@expected); -} - -package MyTest; - -use strict; -use Module::Pluggable only => [ "MyTest::Plugin::Foo" ]; - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -package MyTestSub; - -use strict; -use Module::Pluggable search_path => "MyTest::Plugin"; - - -sub new { - my $class = shift; - my $self = bless {}, $class; - - $self->only(["MyTest::Plugin::Foo"]); - - return $self; -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/12onlyregex.t b/gnu/usr.bin/perl/t/Module_Pluggable/12onlyregex.t deleted file mode 100644 index eff6a162560..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/12onlyregex.t +++ /dev/null @@ -1,65 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; - -{ - my $foo; - ok($foo = MyTest->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Foo); - ok(@plugins = sort $foo->plugins); - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTest->plugins); - is_deeply(\@plugins, \@expected); -} - -{ - my $foo; - ok($foo = MyTestSub->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Foo); - ok(@plugins = sort $foo->plugins); - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTestSub->plugins); - is_deeply(\@plugins, \@expected); -} - -package MyTest; - -use strict; -use Module::Pluggable only => qr/MyTest::Plugin::Foo$/; - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -package MyTestSub; - -use strict; -use Module::Pluggable search_path => "MyTest::Plugin"; - - -sub new { - my $class = shift; - my $self = bless {}, $class; - - $self->only(qr/MyTest::Plugin::Foo$/); - - return $self; -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/13except.t b/gnu/usr.bin/perl/t/Module_Pluggable/13except.t deleted file mode 100644 index 0dbfb20392c..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/13except.t +++ /dev/null @@ -1,68 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; - -{ - my $foo; - ok($foo = MyTest->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); - ok(@plugins = sort $foo->plugins); - - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTest->plugins); - is_deeply(\@plugins, \@expected); -} - -{ - my $foo; - ok($foo = MyTestSub->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); - ok(@plugins = sort $foo->plugins); - - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTestSub->plugins); - is_deeply(\@plugins, \@expected); -} - -package MyTest; - -use strict; -use Module::Pluggable except => "MyTest::Plugin::Foo"; - - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -package MyTestSub; - -use strict; -use Module::Pluggable search_path => "MyTest::Plugin"; - - -sub new { - my $class = shift; - my $self = bless {}, $class; - - $self->except("MyTest::Plugin::Foo"); - - return $self; -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/13exceptarray.t b/gnu/usr.bin/perl/t/Module_Pluggable/13exceptarray.t deleted file mode 100644 index a6313bd12d0..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/13exceptarray.t +++ /dev/null @@ -1,68 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; - -{ - my $foo; - ok($foo = MyTest->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); - ok(@plugins = sort $foo->plugins); - - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTest->plugins); - is_deeply(\@plugins, \@expected); -} - -{ - my $foo; - ok($foo = MyTestSub->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); - ok(@plugins = sort $foo->plugins); - - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTestSub->plugins); - is_deeply(\@plugins, \@expected); -} - -package MyTest; - -use strict; -use Module::Pluggable except => [ "MyTest::Plugin::Foo" ]; - - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -package MyTestSub; - -use strict; -use Module::Pluggable search_path => "MyTest::Plugin"; - - -sub new { - my $class = shift; - my $self = bless {}, $class; - - $self->except(["MyTest::Plugin::Foo"]); - - return $self; -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/13exceptregex.t b/gnu/usr.bin/perl/t/Module_Pluggable/13exceptregex.t deleted file mode 100644 index e3f2638953d..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/13exceptregex.t +++ /dev/null @@ -1,68 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; - -{ - my $foo; - ok($foo = MyTest->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); - ok(@plugins = sort $foo->plugins); - - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTest->plugins); - is_deeply(\@plugins, \@expected); -} - -{ - my $foo; - ok($foo = MyTestSub->new()); - - my @plugins; - my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); - ok(@plugins = sort $foo->plugins); - - is_deeply(\@plugins, \@expected); - - @plugins = (); - - ok(@plugins = sort MyTestSub->plugins); - is_deeply(\@plugins, \@expected); -} - -package MyTest; - -use strict; -use Module::Pluggable except => qr/MyTest::Plugin::Foo/; - - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -package MyTestSub; - -use strict; -use Module::Pluggable search_path => "MyTest::Plugin"; - - -sub new { - my $class = shift; - my $self = bless {}, $class; - - $self->except(qr/MyTest::Plugin::Foo/); - - return $self; -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/14package.t b/gnu/usr.bin/perl/t/Module_Pluggable/14package.t deleted file mode 100644 index 3ba56edaf91..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/14package.t +++ /dev/null @@ -1,34 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 5; - -my $foo; -ok($foo = MyTest->new()); - -my @plugins; -my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected); - -@plugins = (); - -ok(@plugins = sort MyTest->plugins); -is_deeply(\@plugins, \@expected); - - - -package MyTest; -use strict; -sub new { return bless {}, $_[0] } - -package MyOtherTest; -use strict; -use Module::Pluggable ( package => "MyTest" ); -sub new { return bless {}, $_[0] } - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/15topicsafe.t b/gnu/usr.bin/perl/t/Module_Pluggable/15topicsafe.t deleted file mode 100644 index abc980fcc90..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/15topicsafe.t +++ /dev/null @@ -1,16 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More 'no_plan'; - -use Module::Pluggable search_path => 'Acme::MyTest'; - -my $topic = "topic"; - -for ($topic) { - main->plugins; -} - -is($topic, 'topic', "we've got the right topic"); diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/16different_extension.t b/gnu/usr.bin/perl/t/Module_Pluggable/16different_extension.t deleted file mode 100644 index 3f1a4da10c0..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/16different_extension.t +++ /dev/null @@ -1,42 +0,0 @@ -#!perl -w - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 5; - -my $foo; -ok($foo = ExtTest->new()); - -my @plugins; -my @expected = qw(ExtTest::Plugin::Bar ExtTest::Plugin::Foo ExtTest::Plugin::Quux::Foo); -ok(@plugins = sort $foo->plugins); - - - -is_deeply(\@plugins, \@expected, "is deeply"); - -@plugins = (); - -ok(@plugins = sort ExtTest->plugins); - - - - -is_deeply(\@plugins, \@expected, "is deeply class"); - - - -package ExtTest; - -use strict; -use Module::Pluggable file_regex => qr/\.plugin$/; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/17devel_inner_package.t b/gnu/usr.bin/perl/t/Module_Pluggable/17devel_inner_package.t deleted file mode 100644 index 5fabdbfa08d..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/17devel_inner_package.t +++ /dev/null @@ -1,15 +0,0 @@ -#!perl -w -use Test::More tests => 3; - -use Devel::InnerPackage qw(list_packages); -use FindBin; -use lib "$FindBin::Bin/lib"; - -my @packages; - -use_ok("TA::C::A::I"); -ok(@packages = list_packages("TA::C::A::I")); - -is_deeply([sort @packages], [qw(TA::C::A::I::A TA::C::A::I::A::B)]); - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/18skipped_package.t b/gnu/usr.bin/perl/t/Module_Pluggable/18skipped_package.t deleted file mode 100644 index 39917720e43..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/18skipped_package.t +++ /dev/null @@ -1,11 +0,0 @@ -#!perl -w - -use Test::More tests => 1; -use FindBin; -use lib "$FindBin::Bin/lib"; - -use Devel::InnerPackage qw(list_packages); -use No::Middle; - -my @p = list_packages("No::Middle"); -is_deeply([ sort @p ], [ qw(No::Middle::Package::A No::Middle::Package::B) ]); diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/19can_ok_clobber.t b/gnu/usr.bin/perl/t/Module_Pluggable/19can_ok_clobber.t deleted file mode 100644 index 78b03cbbe7e..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/19can_ok_clobber.t +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl -use strict; -use warnings; -use Data::Dumper; -use FindBin; -use lib "$FindBin::Bin/lib"; - -use Test::More tests=>5; - -#use_ok( 'MyTest' ); -#diag "Module::Pluggable::VERSION $Module::Pluggable::VERSION"; - -my @plugins = MyTest->plugins; -my @plugins_after; - -use_ok( 'MyTest::Plugin::Foo' ); -ok( my $foo = MyTest::Plugin::Foo->new() ); - -@plugins_after = MyTest->plugins; -is_deeply( - \@plugins_after, - \@plugins, - "plugins haven't been clobbered", -); - -can_ok ($foo, 'frobnitz'); - -@plugins_after = MyTest->plugins; -is_deeply( - \@plugins_after, - \@plugins, - "plugins haven't been clobbered", -) or diag Dumper ; - - - -package MyTest; - -use strict; -use Module::Pluggable; - - -sub new { - my $class = shift; - return bless {}, $class; - -} -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/20dodgy_files.t b/gnu/usr.bin/perl/t/Module_Pluggable/20dodgy_files.t deleted file mode 100644 index 2486402b534..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/20dodgy_files.t +++ /dev/null @@ -1,74 +0,0 @@ -#!perl -w - -BEGIN { - if ($^O eq 'VMS') { - print "1..0 # Skip: can't handle misspelled plugin names\n"; - exit; - } -} - -use strict; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Test::More tests => 5; - -my $foo; -ok($foo = OddTest->new()); - -my @plugins; -my @expected = ('OddTest::Plugin::-Dodgy', 'OddTest::Plugin::Foo'); -ok(@plugins = sort $foo->plugins); -is_deeply(\@plugins, \@expected, "is deeply"); - -my @odd_plugins; -my @odd_expected = qw(OddTest::Plugin::Foo); -ok(@odd_plugins = sort $foo->odd_plugins); -is_deeply(\@odd_plugins, \@odd_expected, "is deeply"); - - -package OddTest::Pluggable; - -use Data::Dumper; -use base qw(Module::Pluggable::Object); - - -sub find_files { - my $self = shift; - my @files = $self->SUPER::find_files(@_); - return grep { !/(^|\/)-/ } $self->SUPER::find_files(@_) ; -} - -package OddTest; - -use strict; -use Module::Pluggable; - - -sub new { - my $class = shift; - return bless {}, $class; - -} - -sub odd_plugins { - my $self = shift; - my %opts; - my ($pkg, $file) = caller; - # the default name for the method is 'plugins' - my $sub = $opts{'sub_name'} || 'plugins'; - # get our package - my ($package) = $opts{'package'} || "OddTest"; - $opts{filename} = $file; - $opts{package} = $package; - - - - my $op = OddTest::Pluggable->new( package => ref($self) ); - return $op->plugins(@_); - - -} - - -1; - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/acme/Acme/MyTest/Plugin/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/acme/Acme/MyTest/Plugin/Foo.pm deleted file mode 100644 index 29c888baf7a..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/acme/Acme/MyTest/Plugin/Foo.pm +++ /dev/null @@ -1,9 +0,0 @@ -package Acme::MyTest::Plugin::Foo; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/Acme/MyTest/Plugin/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/Acme/MyTest/Plugin/Foo.pm deleted file mode 100644 index 29c888baf7a..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/Acme/MyTest/Plugin/Foo.pm +++ /dev/null @@ -1,9 +0,0 @@ -package Acme::MyTest::Plugin::Foo; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Bar.plugin b/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Bar.plugin deleted file mode 100644 index 2f9b6db0b0f..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Bar.plugin +++ /dev/null @@ -1,9 +0,0 @@ -package MyTest::Plugin::Bar; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Foo.plugin b/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Foo.plugin deleted file mode 100644 index 5386ba5b809..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Foo.plugin +++ /dev/null @@ -1,9 +0,0 @@ -package MyTest::Plugin::Foo; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Quux/Foo.plugin b/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Quux/Foo.plugin deleted file mode 100644 index bb6e08667bd..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/ExtTest/Plugin/Quux/Foo.plugin +++ /dev/null @@ -1,9 +0,0 @@ -package MyTest::Plugin::Quux::Foo; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/InnerTest/Plugin/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/InnerTest/Plugin/Foo.pm deleted file mode 100644 index 4f5825ea655..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/InnerTest/Plugin/Foo.pm +++ /dev/null @@ -1,17 +0,0 @@ -package InnerTest::Plugin::Foo; -use strict; - -our $FOO = 1; - -package InnerTest::Plugin::Bar; -use strict; - -sub bar {} - -package InnerTest::Plugin::Quux; -use strict; -use base qw(InnerTest::Plugin::Bar); - - - -1; diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Bar.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Bar.pm deleted file mode 100644 index 3c5d79dc9bb..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Bar.pm +++ /dev/null @@ -1,5 +0,0 @@ -package MyOtherTest::Plugin::Bar; -use strict; -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Foo.pm deleted file mode 100644 index 14825724b32..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Foo.pm +++ /dev/null @@ -1,5 +0,0 @@ -package MyOtherTest::Plugin::Foo; -use strict; -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Quux.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Quux.pm deleted file mode 100644 index 22fd55d3b9c..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Quux.pm +++ /dev/null @@ -1,5 +0,0 @@ -package MyOtherTest::Plugin::Quux; -use strict; -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Quux/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Quux/Foo.pm deleted file mode 100644 index a8ecd69f114..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyOtherTest/Plugin/Quux/Foo.pm +++ /dev/null @@ -1,5 +0,0 @@ -package MyOtherTest::Plugin::Quux::Foo; -use strict; -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Extend/Plugin/Bar.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Extend/Plugin/Bar.pm deleted file mode 100644 index 6d112cf39fb..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Extend/Plugin/Bar.pm +++ /dev/null @@ -1,17 +0,0 @@ -package MyTest::Extend::Plugin::Bar; -use strict; - -sub new { - my $class = shift; - my %self = @_; - - return bless \%self, $class; -} - - -sub nork { - return $_[0]->{'nork'}; -} -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Bar.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Bar.pm deleted file mode 100644 index 2f9b6db0b0f..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Bar.pm +++ /dev/null @@ -1,9 +0,0 @@ -package MyTest::Plugin::Bar; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Foo.pm deleted file mode 100644 index 6ca83175079..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Foo.pm +++ /dev/null @@ -1,10 +0,0 @@ -package MyTest::Plugin::Foo; - - -use strict; - -sub new { return bless {}, $_[0]; } -sub frobnitz {} -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Quux/Foo.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Quux/Foo.pm deleted file mode 100644 index bb6e08667bd..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/MyTest/Plugin/Quux/Foo.pm +++ /dev/null @@ -1,9 +0,0 @@ -package MyTest::Plugin::Quux::Foo; - - -use strict; - - -1; - - diff --git a/gnu/usr.bin/perl/t/Module_Pluggable/lib/No/Middle.pm b/gnu/usr.bin/perl/t/Module_Pluggable/lib/No/Middle.pm deleted file mode 100644 index 9d0e31ac128..00000000000 --- a/gnu/usr.bin/perl/t/Module_Pluggable/lib/No/Middle.pm +++ /dev/null @@ -1,14 +0,0 @@ -package No::Middle; - -sub foo {} - -package No::Middle::Package::A; - -sub foo {} - - -package No::Middle::Package::B; - -sub foo {} - -1; diff --git a/gnu/usr.bin/perl/t/TEST b/gnu/usr.bin/perl/t/TEST index e702ffbeccb..4e86fd0291c 100644 --- a/gnu/usr.bin/perl/t/TEST +++ b/gnu/usr.bin/perl/t/TEST @@ -14,6 +14,7 @@ $| = 1; # Let tests know they're running in the perl core. Useful for modules # which live dual lives on CPAN. $ENV{PERL_CORE} = 1; +delete $ENV{PERL5LIB}; # remove empty elements due to insertion of empty symbols via "''p1'" syntax @ARGV = grep($_,@ARGV) if $^O eq 'VMS'; @@ -140,9 +141,8 @@ unless (@ARGV) { } my $mani = File::Spec->catfile($updir, "MANIFEST"); if (open(MANI, $mani)) { - my $ext_pat = $^O eq 'MSWin32' ? '(?:win32/)?ext' : 'ext'; while (<MANI>) { # similar code in t/harness - if (m!^($ext_pat/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { + if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { my $t = $1; my $extension = $2; if (!$::core || $t =~ m!^lib/[a-z]!) @@ -151,6 +151,9 @@ unless (@ARGV) { $extension =~ s!/t$!!; # XXX Do I want to warn that I'm skipping these? next if $skip{$extension}; + my $flat_extension = $extension; + $flat_extension =~ s!-!/!g; + next if $skip{$flat_extension}; # Foo/Bar may live in Foo-Bar } my $path = File::Spec->catfile($updir, $t); push @ARGV, $path; @@ -163,7 +166,6 @@ unless (@ARGV) { warn "$0: cannot open $mani: $!\n"; } unless ($::core) { - _find_tests('Module_Pluggable'); _find_tests('pod'); _find_tests('x2p'); _find_tests('japh') if $::torture; @@ -336,6 +338,14 @@ EOT my %todo; while (<RESULTS>) { next if /^\s*$/; # skip blank lines + if (/^1..$/ && ($^O eq 'VMS')) { + # VMS pipe bug inserts blank lines. + my $l2 = <RESULTS>; + if ($l2 =~ /^\s*$/) { + $l2 = <RESULTS>; + } + $_ = '1..' . $l2; + } if ($::verbose) { print $_; } @@ -383,7 +393,7 @@ EOT # SKIP is essentially the same as TODO for t/TEST # this still conforms to TAP: - # http://search.cpan.org/dist/Test-Harness/lib/Test/Harness/TAP.pod + # http://search.cpan.org/dist/TAP/TAP.pod $extra and $istodo = $extra =~ /#\s*(?:TODO|SKIP)\b/; $istodo = 1 if $todo{$num}; diff --git a/gnu/usr.bin/perl/t/harness b/gnu/usr.bin/perl/t/harness index e7c1e882712..5e5ddf4c820 100644 --- a/gnu/usr.bin/perl/t/harness +++ b/gnu/usr.bin/perl/t/harness @@ -6,15 +6,16 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; # pick up only this build's lib - $ENV{PERL5LIB} = '../lib'; # so children will see it too } +delete $ENV{PERL5LIB}; my $torture; # torture testing? use Test::Harness; +use strict; $Test::Harness::switches = ""; # Too much noise otherwise -$Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v'; +$Test::Harness::Verbose++ while @ARGV && $ARGV[0] eq '-v' && shift; if ($ARGV[0] && $ARGV[0] eq '-torture') { shift; @@ -26,7 +27,7 @@ if ($ARGV[0] && $ARGV[0] eq '-torture') { $ENV{PERL_CORE} = 1; #fudge DATA for now. -%datahandle = qw( +my %datahandle = qw( lib/bigint.t 1 lib/bigintpm.t 1 lib/bigfloat.t 1 @@ -45,7 +46,7 @@ foreach (keys %datahandle) { unlink "$_.t"; } -my @tests = (); +my (@tests, $re); # [.VMS]TEST.COM calls harness with empty arguments, so clean-up @ARGV @ARGV = grep $_ && length( $_ ) => @ARGV; @@ -54,6 +55,41 @@ sub _populate_hash { return map {$_, 1} split /\s+/, $_[0]; } +# Generate T::H schedule rules that run the contents of each directory +# sequentially. +sub _seq_dir_rules { + my @tests = @_; + my %dir; + for (@tests) { + s{[^/]+$}{\*}; + $dir{$_}++; + } + + return { par => [ map { { seq => $_ } } sort keys %dir ] }; +} + +sub _extract_tests; +sub _extract_tests { + # This can probably be done more tersely with a map, but I doubt that it + # would be as clear + my @results; + foreach (@_) { + my $ref = ref $_; + if ($ref) { + if ($ref eq 'ARRAY') { + push @results, _extract_tests @$_; + } elsif ($ref eq 'HASH') { + push @results, _extract_tests values %$_; + } else { + die "Unknown reference type $ref"; + } + } else { + push @results, glob $_; + } + } + @results; +} + if ($ARGV[0] && $ARGV[0]=~/^-re/) { if ($ARGV[0]!~/=/) { shift; @@ -64,7 +100,27 @@ if ($ARGV[0] && $ARGV[0]=~/^-re/) { } } +my $jobs = $ENV{TEST_JOBS}; +my ($fork, $rules, $state); +if ($ENV{HARNESS_OPTIONS}) { + for my $opt ( split /:/, $ENV{HARNESS_OPTIONS} ) { + if ( $opt =~ /^j(\d*)$/ ) { + $jobs ||= $1 || 9; + } + elsif ( $opt eq 'f' ) { + $fork = 1; + } + elsif ( $opt eq 'c' ) { +# $args->{color} = 1; + } + else { + die "Unknown HARNESS_OPTIONS item: $opt\n"; + } + } +} + if (@ARGV) { + # If you want these run in speed order, just use prove if ($^O eq 'MSWin32') { @tests = map(glob($_),@ARGV); } @@ -72,18 +128,52 @@ if (@ARGV) { @tests = @ARGV; } } else { + # Ideally we'd get somewhere close to Tux's Oslo rules + # my $rules = { + # par => [ + # { seq => '../ext/DB_File/t/*' }, + # { seq => '../ext/IO_Compress_Zlib/t/*' }, + # { seq => '../lib/CPANPLUS/*' }, + # { seq => '../lib/ExtUtils/t/*' }, + # '*' + # ] + # }; + + # but for now, run all directories in sequence. In particular, it would be + # nice to get the tests in t/op/*.t able to run in parallel. + unless (@tests) { - push @tests, <base/*.t>; - push @tests, <comp/*.t>; - push @tests, <cmd/*.t>; - push @tests, <run/*.t>; - push @tests, <io/*.t>; - push @tests, <op/*.t>; - push @tests, <uni/*.t>; - push @tests, <mro/*.t>; - push @tests, <lib/*.t>; - push @tests, <japh/*.t> if $torture; - push @tests, <win32/*.t> if $^O eq 'MSWin32'; + my @seq = <base/*.t>; + + my @next = qw(comp cmd run io op uni mro lib); + push @next, 'japh' if $torture; + push @next, 'win32' if $^O eq 'MSWin32'; + # Hopefully TAP::Parser::Scheduler will support this syntax soon. + # my $next = { par => '{' . join (',', @next) . '}/*.t' }; + my $next = { par => [ + map { "$_/*.t" } @next + ] }; + @tests = _extract_tests ($next); + + # This is a bit of a game, because we only want to sort these tests in + # speed order. base/*.t wants to run first, and ext,lib etc last and in + # MANIFEST order + if ($jobs) { + require App::Prove::State; + $state = App::Prove::State->new({ store => 'test_state' }); + $state->apply_switch('slow', 'save'); + # For some reason get_tests returns *all* the tests previously run, + # (in the right order), not simply the selection in @tests + # (in the right order). Not sure if this is a bug or a feature. + # Whatever, *we* are only interested in the ones that are in @tests + my %seen; + @seen{@tests} = (); + @tests = grep {exists $seen{$_} } $state->get_tests(0, @tests); + } + @tests = (@seq, @tests); + push @seq, $next; + + my @last; use Config; my %skip; { @@ -98,14 +188,16 @@ if (@ARGV) { my $mani = File::Spec->catfile(File::Spec->updir, "MANIFEST"); if (open(MANI, $mani)) { my @manitests = (); - my $ext_pat = $^O eq 'MSWin32' ? '(?:win32/)?ext' : 'ext'; while (<MANI>) { # similar code in t/TEST - if (m!^($ext_pat/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { + if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { my ($test, $extension) = ($1, $2); if (defined $extension) { $extension =~ s!/t$!!; # XXX Do I want to warn that I'm skipping these? next if $skip{$extension}; + my $flat_extension = $extension; + $flat_extension =~ s!-!/!g; + next if $skip{$flat_extension}; # Foo/Bar may live in Foo-Bar } push @manitests, File::Spec->catfile($updir, $test); } @@ -113,13 +205,18 @@ if (@ARGV) { close MANI; # Sort the list of test files read from MANIFEST into a sensible # order instead of using the order in which they are listed there - push @tests, sort { lc $a cmp lc $b } @manitests; + push @last, sort { lc $a cmp lc $b } @manitests; } else { warn "$0: cannot open $mani: $!\n"; } - push @tests, <Module_Pluggable/*.t>; - push @tests, <pod/*.t>; - push @tests, <x2p/*.t>; + push @last, <pod/*.t>; + push @last, <x2p/*.t>; + + push @tests, @last; + + push @seq, _seq_dir_rules @last; + + $rules = { seq => \@seq }; } } if ($^O eq 'MSWin32') { @@ -127,5 +224,33 @@ if ($^O eq 'MSWin32') { } @tests=grep /$re/, @tests if $re; -Test::Harness::runtests @tests; + +if ($jobs) { + eval 'use TAP::Harness 3.13; 1' or die $@; + + # Test::Harness parses $ENV{HARNESS_OPTIONS}, TAP::Harness does not + local $ENV{HARNESS_OPTIONS}; + my $h = TAP::Harness->new({ jobs => $jobs, rules => $rules, ($fork ? (fork => $fork) : ())}); + if ($state) { + $h->callback( + after_test => sub { + $state->observe_test(@_); + } + ); + $h->callback( + after_runtests => sub { + $state->commit(@_); + } + ); + } + $h->callback( + parser_args => sub { + my ( $args, $test ) = @_; + push @{ $args->{switches} }, '-I../lib'; + } + ); + $h->runtests(@tests); +} else { + Test::Harness::runtests @tests; +} exit(0); |