[svn:parrot] r42252 - in branches/configtests/t/steps: init init/hints inter

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Wed Nov 4 13:36:35 UTC 2009


Author: jkeenan
Date: Wed Nov  4 13:36:33 2009
New Revision: 42252
URL: https://trac.parrot.org/parrot/changeset/42252

Log:
Adapt steps test to use of all configuration data.

Modified:
   branches/configtests/t/steps/init/headers-01.t
   branches/configtests/t/steps/init/hints-01.t
   branches/configtests/t/steps/init/hints/darwin-01.t
   branches/configtests/t/steps/inter/lex-01.t
   branches/configtests/t/steps/inter/make-01.t
   branches/configtests/t/steps/inter/progs-01.t

Modified: branches/configtests/t/steps/init/headers-01.t
==============================================================================
--- branches/configtests/t/steps/init/headers-01.t	Wed Nov  4 03:39:22 2009	(r42251)
+++ branches/configtests/t/steps/init/headers-01.t	Wed Nov  4 13:36:33 2009	(r42252)
@@ -15,6 +15,7 @@
 use_ok('config::init::headers');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
 
 my $pkg  = q{init::headers};
 my ($args, $step_list_ref) = process_options(
@@ -24,7 +25,9 @@
     }
 );
 
-my $conf = Parrot::Configure->new;
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
+
 $conf->add_steps($pkg);
 $conf->options->set( %{$args} );
 

Modified: branches/configtests/t/steps/init/hints-01.t
==============================================================================
--- branches/configtests/t/steps/init/hints-01.t	Wed Nov  4 03:39:22 2009	(r42251)
+++ branches/configtests/t/steps/init/hints-01.t	Wed Nov  4 13:36:33 2009	(r42252)
@@ -5,20 +5,17 @@
 
 use strict;
 use warnings;
-use Test::More qw(no_plan); # tests => 26;
+use Test::More tests => 21;
 use Carp;
 use Cwd;
-use Data::Dumper;$Data::Dumper::Indent=1;
 use File::Path ();
 use File::Spec::Functions qw/catfile/;
 use File::Temp qw(tempdir);
 use lib qw( lib t/configure/testlib );
-#use_ok('config::init::defaults');
 use_ok('config::init::hints');
-use Parrot::Configure::Step::Test;
 use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
 use Parrot::Configure::Test qw(
-    test_step_thru_runstep
     test_step_constructor_and_description
 );
 use IO::CaptureOutput qw | capture |;
@@ -33,144 +30,139 @@
 );
 
 my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
 
-#test_step_thru_runstep( $conf, q{init::defaults}, $args );
+my $pkg = q{init::hints};
 
-$conf->include_config_results( $args );
+$conf->add_steps($pkg);
+
+my $serialized = $conf->pcfreeze();
+
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+
+# need to capture the --verbose output, because the fact that it does not end
+# in a newline confuses Test::Harness
+{
+    my $rv;
+    my $stdout;
+    capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
+    ok( $stdout, "verbose output:  hints were captured" );
+    ok( defined $rv, "runstep() returned defined value" );
+}
+
+$conf->replenish($serialized);
+
+########## --verbose; local hints directory ##########
+
+($args, $step_list_ref) = process_options(
+    {
+        argv => [q{--verbose}],
+        mode => q{configure},
+    }
+);
+
+$conf->options->set( %{$args} );
+$step = test_step_constructor_and_description($conf);
+
+my $cwd = cwd();
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    File::Path::mkpath(qq{$tdir/init/hints})
+        or croak "Unable to create directory for local hints";
+    my $localhints = qq{$tdir/init/hints/local.pm};
+    open my $FH, '>', $localhints
+        or croak "Unable to open temp file for writing";
+    print $FH <<END;
+package init::hints::local;
+use strict;
+sub runstep {
+    return 1;
+}
+1;
+END
+    close $FH or croak "Unable to close temp file after writing";
+    unshift( @INC, $tdir );
+
+    {
+     my $rv;
+     my $stdout;
+     capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
+     ok( $stdout, "verbose output:  hints were captured" );
+     ok( defined $rv, "runstep() returned defined value" );
+    }
+    unlink $localhints or croak "Unable to delete $localhints";
+}
 
-#print STDERR Dumper $conf;
+$conf->replenish($serialized);
+
+########## --verbose; local hints directory; no runstep() in local hints ##########
+
+($args, $step_list_ref) = process_options(
+    {
+        argv => [q{--verbose}],
+        mode => q{configure},
+    }
+);
+
+$conf->options->set( %{$args} );
+$step = test_step_constructor_and_description($conf);
+
+$cwd = cwd();
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    File::Path::mkpath(qq{$tdir/init/hints})
+        or croak "Unable to create directory for local hints";
+    my $localhints = qq{$tdir/init/hints/local.pm};
+    open my $FH, '>', $localhints
+        or croak "Unable to open temp file for writing";
+    print $FH <<END;
+package init::hints::local;
+use strict;
+1;
+END
+    close $FH or croak "Unable to close temp file after writing";
+    unshift( @INC, $tdir );
+
+    {
+     my $rv;
+     my $stdout;
+     capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
+     ok( $stdout, "verbose output:  hints were captured" );
+     ok( defined $rv, "runstep() returned defined value" );
+    }
+    unlink $localhints or croak "Unable to delete $localhints";
+}
+
+$conf->replenish($serialized);
+
+########## --verbose; imaginary OS ##########
+
+($args, $step_list_ref) = process_options(
+    {
+        argv => [ q{--verbose} ],
+        mode => q{configure},
+    }
+);
 
-#my $pkg = q{init::hints};
-#
-#$conf->add_steps($pkg);
-#
-#my $serialized = $conf->pcfreeze();
-#
-#$conf->options->set( %{$args} );
-#my $step = test_step_constructor_and_description($conf);
-#
-## need to capture the --verbose output, because the fact that it does not end
-## in a newline confuses Test::Harness
-#{
-#    my $rv;
-#    my $stdout;
-#    capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
-#    ok( $stdout, "verbose output:  hints were captured" );
-#    ok( defined $rv, "runstep() returned defined value" );
-#}
-#
-#$conf->replenish($serialized);
-#
-########### --verbose; local hints directory ##########
-#
-#($args, $step_list_ref) = process_options(
-#    {
-#        argv => [q{--verbose}],
-#        mode => q{configure},
-#    }
-#);
-#
-#$conf->options->set( %{$args} );
-#$step = test_step_constructor_and_description($conf);
-#
-#my $cwd = cwd();
-#{
-#    my $tdir = tempdir( CLEANUP => 1 );
-#    File::Path::mkpath(qq{$tdir/init/hints})
-#        or croak "Unable to create directory for local hints";
-#    my $localhints = qq{$tdir/init/hints/local.pm};
-#    open my $FH, '>', $localhints
-#        or croak "Unable to open temp file for writing";
-#    print $FH <<END;
-#package init::hints::local;
-#use strict;
-#sub runstep {
-#    return 1;
-#}
-#1;
-#END
-#    close $FH or croak "Unable to close temp file after writing";
-#    unshift( @INC, $tdir );
-#
-#    {
-#     my $rv;
-#     my $stdout;
-#     capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
-#     ok( $stdout, "verbose output:  hints were captured" );
-#     ok( defined $rv, "runstep() returned defined value" );
-#    }
-#    unlink $localhints or croak "Unable to delete $localhints";
-#}
-#
-#$conf->replenish($serialized);
-#
-########### --verbose; local hints directory; no runstep() in local hints ##########
-#
-#($args, $step_list_ref) = process_options(
-#    {
-#        argv => [q{--verbose}],
-#        mode => q{configure},
-#    }
-#);
-#
-#$conf->options->set( %{$args} );
-#$step = test_step_constructor_and_description($conf);
-#
-#$cwd = cwd();
-#{
-#    my $tdir = tempdir( CLEANUP => 1 );
-#    File::Path::mkpath(qq{$tdir/init/hints})
-#        or croak "Unable to create directory for local hints";
-#    my $localhints = qq{$tdir/init/hints/local.pm};
-#    open my $FH, '>', $localhints
-#        or croak "Unable to open temp file for writing";
-#    print $FH <<END;
-#package init::hints::local;
-#use strict;
-#1;
-#END
-#    close $FH or croak "Unable to close temp file after writing";
-#    unshift( @INC, $tdir );
-#
-#    {
-#     my $rv;
-#     my $stdout;
-#     capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
-#     ok( $stdout, "verbose output:  hints were captured" );
-#     ok( defined $rv, "runstep() returned defined value" );
-#    }
-#    unlink $localhints or croak "Unable to delete $localhints";
-#}
-#
-#$conf->replenish($serialized);
-#
-########### --verbose; imaginary OS ##########
-#
-#($args, $step_list_ref) = process_options(
-#    {
-#        argv => [ q{--verbose} ],
-#        mode => q{configure},
-#    }
-#);
-#
-#$conf->options->set( %{$args} );
-#$step = test_step_constructor_and_description($conf);
-#{
-#    my ($stdout, $stderr, $ret);
-#    $conf->data->set_p5( OSNAME => q{imaginaryOS} );
-#    my $osname = lc( $conf->data->get_p5( 'OSNAME' ) );
-#    my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
-#    capture (
-#        sub { $ret = $step->runstep($conf); },
-#        \$stdout,
-#        \$stderr,
-#    );;
-#    like(
-#        $stdout,
-#        qr/No \Q$hints_file\E found/s,
-#        "Got expected verbose output when no hints file found"
-#    );
-#}
+$conf->options->set( %{$args} );
+$step = test_step_constructor_and_description($conf);
+{
+    my ($stdout, $stderr, $ret);
+    $conf->data->set_p5( OSNAME => q{imaginaryOS} );
+    my $osname = lc( $conf->data->get_p5( 'OSNAME' ) );
+    my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
+    capture (
+        sub { $ret = $step->runstep($conf); },
+        \$stdout,
+        \$stderr,
+    );;
+    like(
+        $stdout,
+        qr/No \Q$hints_file\E found/s,
+        "Got expected verbose output when no hints file found"
+    );
+}
 
 pass("Completed all tests in $0");
 

Modified: branches/configtests/t/steps/init/hints/darwin-01.t
==============================================================================
--- branches/configtests/t/steps/init/hints/darwin-01.t	Wed Nov  4 03:39:22 2009	(r42251)
+++ branches/configtests/t/steps/init/hints/darwin-01.t	Wed Nov  4 13:36:33 2009	(r42252)
@@ -9,17 +9,15 @@
 use File::Temp qw( tempdir );
 use Test::More;
 plan( skip_all => 'only needs testing on Darwin' ) unless $^O =~ /darwin/i;
-plan( tests =>  41 );
-#use Test::More qw(no_plan); # tests => 41;
+plan( tests =>  36 );
 
 use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
 use_ok('config::init::hints');
 use_ok('config::init::hints::darwin');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
 use Parrot::Configure::Test qw(
-    test_step_thru_runstep
     test_step_constructor_and_description
 );
 use IO::CaptureOutput qw | capture |;
@@ -32,9 +30,8 @@
     }
 );
 
-my $conf = Parrot::Configure->new;
-
-test_step_thru_runstep( $conf, q{init::defaults}, $args );
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
 
 ##### Tests of some internal subroutines #####
 

Modified: branches/configtests/t/steps/inter/lex-01.t
==============================================================================
--- branches/configtests/t/steps/inter/lex-01.t	Wed Nov  4 03:39:22 2009	(r42251)
+++ branches/configtests/t/steps/inter/lex-01.t	Wed Nov  4 13:36:33 2009	(r42252)
@@ -5,17 +5,15 @@
 
 use strict;
 use warnings;
-use Test::More tests => 31;
+use Test::More tests => 26;
 use Carp;
 use Data::Dumper;
 use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
 use_ok('config::inter::lex');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
 use Parrot::Configure::Test qw(
-    test_step_thru_runstep
-    rerun_defaults_for_testing
     test_step_constructor_and_description
 );
 use Tie::Filehandle::Preempt::Stdin;
@@ -30,9 +28,8 @@
     }
 );
 
-my $conf = Parrot::Configure->new();
-
-test_step_thru_runstep( $conf, q{init::defaults}, $args );
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
 
 my $pkg = q{inter::lex};
 

Modified: branches/configtests/t/steps/inter/make-01.t
==============================================================================
--- branches/configtests/t/steps/inter/make-01.t	Wed Nov  4 03:39:22 2009	(r42251)
+++ branches/configtests/t/steps/inter/make-01.t	Wed Nov  4 13:36:33 2009	(r42252)
@@ -5,15 +5,14 @@
 
 use strict;
 use warnings;
-use Test::More tests => 18;
+use Test::More tests => 13;
 use Carp;
 use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
 use_ok('config::inter::make');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
 use Parrot::Configure::Test qw(
-    test_step_thru_runstep
     test_step_constructor_and_description
 );
 use Tie::Filehandle::Preempt::Stdin;
@@ -27,9 +26,8 @@
     }
 );
 
-my $conf = Parrot::Configure->new();
-
-test_step_thru_runstep( $conf, q{init::defaults}, $args );
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
 
 my $pkg = q{inter::make};
 

Modified: branches/configtests/t/steps/inter/progs-01.t
==============================================================================
--- branches/configtests/t/steps/inter/progs-01.t	Wed Nov  4 03:39:22 2009	(r42251)
+++ branches/configtests/t/steps/inter/progs-01.t	Wed Nov  4 13:36:33 2009	(r42252)
@@ -6,17 +6,14 @@
 use strict;
 use warnings;
 
-use Test::More tests => 24;
+use Test::More tests =>  9;
 use Carp;
 use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
-use_ok('config::init::install');
-use_ok('config::init::hints');
 use_ok('config::inter::progs');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
 use Parrot::Configure::Test qw(
-    test_step_thru_runstep
     test_step_constructor_and_description
 );
 use Tie::Filehandle::Preempt::Stdin;
@@ -38,11 +35,8 @@
     }
 );
 
-my $conf = Parrot::Configure->new;
-
-test_step_thru_runstep( $conf, q{init::defaults}, $args );
-test_step_thru_runstep( $conf, q{init::install},  $args );
-test_step_thru_runstep( $conf, q{init::hints},    $args );
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
 
 my $pkg = q{inter::progs};
 


More information about the parrot-commits mailing list