Skip to content

Commit

Permalink
Synced tests up with the core versions
Browse files Browse the repository at this point in the history
  • Loading branch information
schwern committed Jan 11, 2002
1 parent 13ff40c commit 7205473
Show file tree
Hide file tree
Showing 28 changed files with 236 additions and 13 deletions.
7 changes: 7 additions & 0 deletions t/Builder.t
@@ -1,5 +1,12 @@
#!/usr/bin/perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::Builder;
my $Test = Test::Builder->new;

Expand Down
7 changes: 7 additions & 0 deletions t/More.t
@@ -1,5 +1,12 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::More tests => 37;

# Make sure we don't mess with $@ or $!. Test at bottom.
Expand Down
7 changes: 7 additions & 0 deletions t/buffer.t
@@ -1,5 +1,12 @@
#!/usr/bin/perl

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

# Ensure that intermixed prints to STDOUT and tests come out in the
# right order (ie. no buffering problems).

Expand Down
7 changes: 7 additions & 0 deletions t/diag.t
@@ -1,5 +1,12 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use strict;

use Test::More tests => 5;
Expand Down
12 changes: 10 additions & 2 deletions t/exit.t
@@ -1,6 +1,13 @@
# Can't use Test.pm, that's a 5.005 thing.
package My::Test;

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

unless( eval { require File::Spec } ) {
print "1..0 # Skip Need File::Spec to run this test\n";
exit 0;
Expand Down Expand Up @@ -47,7 +54,8 @@ my %Tests = (

print "1..".keys(%Tests)."\n";

my $lib = File::Spec->catdir(qw(t lib Test Simple sample_tests));
chdir 't';
my $lib = File::Spec->catdir(qw(lib Test Simple sample_tests));
while( my($test_name, $exit_codes) = each %Tests ) {
my($exit_code) = $exit_codes->[$IsVMS ? 1 : 0];

Expand All @@ -63,7 +71,7 @@ while( my($test_name, $exit_codes) = each %Tests ) {
}

my $file = File::Spec->catfile($lib, $test_name);
my $wait_stat = system(qq{$Perl -"Iblib/lib" $file});
my $wait_stat = system(qq{$Perl -"I../blib/lib" -"I../lib" -"I../t/lib" $file});
my $actual_exit = $wait_stat >> 8;

My::Test::ok( $actual_exit == $exit_code,
Expand Down
10 changes: 9 additions & 1 deletion t/extra.t
@@ -1,5 +1,12 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

# Can't use Test.pm, that's a 5.005 thing.
package My::Test;

Expand All @@ -23,7 +30,8 @@ package main;

require Test::Simple;

push @INC, 't/lib/';
chdir 't';
push @INC, '../t/lib/';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();

Expand Down
10 changes: 9 additions & 1 deletion t/fail-like.t
Expand Up @@ -7,12 +7,20 @@ BEGIN {
}
}

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

# There was a bug with like() involving a qr// not failing properly.
# This tests against that.

use strict;
use lib 't/lib';

require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
Expand Down
11 changes: 10 additions & 1 deletion t/fail-more.t
@@ -1,7 +1,16 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

use strict;
use lib 't/lib';

require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
Expand Down
11 changes: 10 additions & 1 deletion t/fail.t
@@ -1,7 +1,16 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

use strict;
use lib qw(t/lib);

require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();
Expand Down
7 changes: 7 additions & 0 deletions t/filehandles.t
@@ -1,5 +1,12 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::More tests => 1;

tie *STDOUT, "Dev::Null" or die $!;
Expand Down
8 changes: 8 additions & 0 deletions t/import.t
@@ -1,3 +1,11 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}


use Test::More tests => 2, import => [qw(!fail)];

can_ok(__PACKAGE__, qw(ok pass like isa_ok));
Expand Down
11 changes: 10 additions & 1 deletion t/is_deeply.t
@@ -1,7 +1,16 @@
#!/usr/bin/perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

use strict;
use lib qw(t/lib);

use Test::Builder;
require Test::Simple::Catch;
Expand Down
11 changes: 10 additions & 1 deletion t/missing.t
@@ -1,3 +1,13 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

# Can't use Test.pm, that's a 5.005 thing.
package My::Test;

Expand All @@ -21,7 +31,6 @@ package main;

require Test::Simple;

push @INC, 't/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();

Expand Down
7 changes: 7 additions & 0 deletions t/no_ending.t
@@ -1,5 +1,12 @@
use Test::Builder;

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

BEGIN {
my $t = Test::Builder->new;
$t->no_ending(1);
Expand Down
7 changes: 7 additions & 0 deletions t/no_header.t
@@ -1,3 +1,10 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::Builder;

# STDOUT must be unbuffered else our prints might come out after
Expand Down
11 changes: 10 additions & 1 deletion t/no_plan.t
@@ -1,3 +1,13 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

# Can't use Test.pm, that's a 5.005 thing.
package My::Test;

Expand All @@ -21,7 +31,6 @@ package main;

require Test::Simple;

push @INC, 't/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();

Expand Down
7 changes: 6 additions & 1 deletion t/output.t
@@ -1,6 +1,11 @@
#!perl -w

chdir 't' if -d 't';
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

# Can't use Test.pm, that's a 5.005 thing.
print "1..3\n";
Expand Down
7 changes: 7 additions & 0 deletions t/plan.t
@@ -1,3 +1,10 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::More;

plan tests => 2;
Expand Down
18 changes: 16 additions & 2 deletions t/plan_is_noplan.t
@@ -1,8 +1,23 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

# Can't use Test.pm, that's a 5.005 thing.
package My::Test;

# This feature requires a fairly new version of Test::Harness
BEGIN {
if( !$ENV{HARNESS_ACTIVE} && $ENV{PERL_CORE} ) {
print "1..0 # Skipped: Won't work with t/TEST\n";
exit 0;
}

# This feature requires a fairly new version of Test::Harness
require Test::Harness;
if( $Test::Harness::VERSION < 1.20 ) {
print "1..0 # Skipped: Need Test::Harness 1.20 or up\n";
Expand Down Expand Up @@ -30,7 +45,6 @@ package main;

require Test::Simple;

push @INC, 't/lib';
require Test::Simple::Catch;
my($out, $err) = Test::Simple::Catch::caught();

Expand Down
13 changes: 13 additions & 0 deletions t/plan_no_plan.t
@@ -1,5 +1,18 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::More;

BEGIN {
if( !$ENV{HARNESS_ACTIVE} && $ENV{PERL_CORE} ) {
plan skip_all => "Won't work with t/TEST";
}
}

BEGIN {
require Test::Harness;
}
Expand Down
7 changes: 7 additions & 0 deletions t/plan_skip_all.t
@@ -1,3 +1,10 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::More;

plan skip_all => 'Just testing plan & skip_all';
Expand Down
7 changes: 7 additions & 0 deletions t/simple.t
@@ -1,3 +1,10 @@
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use strict;

BEGIN { $| = 1; $^W = 1; }
Expand Down
7 changes: 7 additions & 0 deletions t/skip.t
@@ -1,5 +1,12 @@
#!perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = '../lib';
}
}

use Test::More tests => 15;

# If we skip with the same name, Test::Harness will report it back and
Expand Down

0 comments on commit 7205473

Please sign in to comment.