bring Test::Harness up to 3.06
[p5sagit/p5-mst-13.2.git] / lib / Test / Harness / t / state.t
index 0963a7e..7ec4cfd 100644 (file)
@@ -1,21 +1,25 @@
 #!/usr/bin/perl -w
 
-use strict;
-use lib 't/lib';
+BEGIN {
+    if ( $ENV{PERL_CORE} ) {
+        chdir 't';
+        @INC = '../lib';
+    }
+    else {
+        unshift @INC, 't/lib';
+    }
+}
 
+use strict;
 use Test::More;
 use App::Prove::State;
 
-my @schedule = (
+sub mn {
+    my $pfx = $ENV{PERL_CORE} ? '../lib/Test/Harness/' : '';
+    return map {"$pfx$_"} @_;
+}
 
-    # last => sub {
-    # failed => sub {
-    # passed => sub {
-    # all => sub {
-    # todo => sub {
-    # hot => sub {
-    # save => sub {
-    # adrian => sub {
+my @schedule = (
     {   options        => 'all',
         get_tests_args => [],
         expect         => [
@@ -127,23 +131,23 @@ my @schedule = (
     {   options        => 'old',
         get_tests_args => [],
         expect         => [
-            't/compat/env.t',
-            't/compat/failure.t',
+            't/source.t',
             't/compat/inc_taint.t',
             't/compat/version.t',
-            't/source.t',
             't/yamlish-writer.t',
+            't/compat/failure.t',
+            't/compat/env.t',
         ],
     },
     {   options        => 'new',
         get_tests_args => [],
         expect         => [
-            't/source.t',
-            't/yamlish-writer.t',
-            't/compat/inc_taint.t',
-            't/compat/version.t',
             't/compat/env.t',
             't/compat/failure.t',
+            't/yamlish-writer.t',
+            't/compat/version.t',
+            't/compat/inc_taint.t',
+            't/source.t',
         ],
     },
 );
@@ -162,11 +166,11 @@ for my $test (@schedule) {
     $options = [$options] unless 'ARRAY' eq ref $options;
     $state->apply_switch(@$options);
 
-    my @got = $state->get_tests( @{ $test->{get_tests_args} } );
-
-    unless ( is_deeply \@got, $test->{expect}, "$desc: order OK" ) {
+    my @got    = $state->get_tests( @{ $test->{get_tests_args} } );
+    my @expect = mn( @{ $test->{expect} } );
+    unless ( is_deeply \@got, \@expect, "$desc: order OK" ) {
         use Data::Dumper;
-        diag( Dumper( { got => \@got, want => $test->{expect} } ) );
+        diag( Dumper( { got => \@got, want => \@expect } ) );
     }
 }
 
@@ -174,7 +178,7 @@ sub get_state {
     return {
         'generation' => '51',
         'tests'      => {
-            't/compat/failure.t' => {
+            mn('t/compat/failure.t') => {
                 'last_result'    => '0',
                 'last_run_time'  => '1196371471.57738',
                 'last_pass_time' => '1196371471.57738',
@@ -182,9 +186,10 @@ sub get_state {
                 'seq'            => '1549',
                 'gen'            => '51',
                 'elapsed'        => 0.1230,
-                'last_todo'      => '1'
+                'last_todo'      => '1',
+                'mtime'          => 1196285623,
             },
-            't/yamlish-writer.t' => {
+            mn('t/yamlish-writer.t') => {
                 'last_result'    => '0',
                 'last_run_time'  => '1196371480.5761',
                 'last_pass_time' => '1196371480.5761',
@@ -193,9 +198,10 @@ sub get_state {
                 'seq'            => '1578',
                 'gen'            => '49',
                 'elapsed'        => 12.2983,
-                'last_todo'      => '0'
+                'last_todo'      => '0',
+                'mtime'          => 1196285400,
             },
-            't/compat/env.t' => {
+            mn('t/compat/env.t') => {
                 'last_result'    => '0',
                 'last_run_time'  => '1196371471.42967',
                 'last_pass_time' => '1196371471.42967',
@@ -204,9 +210,10 @@ sub get_state {
                 'seq'            => '1548',
                 'gen'            => '52',
                 'elapsed'        => 3.1290,
-                'last_todo'      => '0'
+                'last_todo'      => '0',
+                'mtime'          => 1196285739,
             },
-            't/compat/version.t' => {
+            mn('t/compat/version.t') => {
                 'last_result'    => '2',
                 'last_run_time'  => '1196371472.96476',
                 'last_pass_time' => '1196371472.96476',
@@ -215,9 +222,10 @@ sub get_state {
                 'seq'            => '1555',
                 'gen'            => '51',
                 'elapsed'        => 0.2363,
-                'last_todo'      => '4'
+                'last_todo'      => '4',
+                'mtime'          => 1196285239,
             },
-            't/compat/inc_taint.t' => {
+            mn('t/compat/inc_taint.t') => {
                 'last_result'    => '3',
                 'last_run_time'  => '1196371471.89682',
                 'last_pass_time' => '1196371471.89682',
@@ -225,9 +233,10 @@ sub get_state {
                 'seq'            => '1551',
                 'gen'            => '51',
                 'elapsed'        => 1.6938,
-                'last_todo'      => '0'
+                'last_todo'      => '0',
+                'mtime'          => 1196185639,
             },
-            't/source.t' => {
+            mn('t/source.t') => {
                 'last_result'    => '0',
                 'last_run_time'  => '1196371479.72508',
                 'last_pass_time' => '1196371479.72508',
@@ -235,7 +244,8 @@ sub get_state {
                 'seq'            => '1570',
                 'gen'            => '51',
                 'elapsed'        => 0.0143,
-                'last_todo'      => '0'
+                'last_todo'      => '0',
+                'mtime'          => 1186285639,
             },
         }
     };