Author: jkeenan
Date: Wed Oct  3 18:17:50 2007
New Revision: 21803

Added:
   branches/reconfigure/t/configure/048-return_undef.t   (contents, props 
changed)
Removed:
   branches/reconfigure/t/configure/testlib/init/iota.pm
Modified:
   branches/reconfigure/MANIFEST
   branches/reconfigure/t/configure/042-fatal_step.t
   branches/reconfigure/t/configure/043-fatal_step.t
   branches/reconfigure/t/configure/044-fatal_step.t
   branches/reconfigure/t/configure/testlib/init/eta.pm

Log:
Clone t/configure/040-return_undef.t to 048-return_undef.t, but use zeta.pm
instead of eta.pm to maximize condition coverage in internal sub
_failure_message().  Eliminate t/configure/testlib/init/iota.pm; YAGNI.
Change usages of iota.pm in t/configure/042-fatal_step.pm, 043, 044 to usages
of zeta.pm.


Modified: branches/reconfigure/MANIFEST
==============================================================================
--- branches/reconfigure/MANIFEST       (original)
+++ branches/reconfigure/MANIFEST       Wed Oct  3 18:17:50 2007
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Oct  2 01:12:01 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Oct  4 01:12:46 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2959,6 +2959,7 @@
 t/configure/045-fatal_step.t                                []
 t/configure/046-inter.t                                     []
 t/configure/047-inter.t                                     []
+t/configure/048-return_undef.t                              []
 t/configure/101-init_manifest.01.t                          []
 t/configure/101-init_manifest.02.t                          []
 t/configure/102-init_defaults.01.t                          []
@@ -3046,7 +3047,6 @@
 t/configure/testlib/init/eta.pm                             []
 t/configure/testlib/init/foobar.pm                          []
 t/configure/testlib/init/gamma.pm                           []
-t/configure/testlib/init/iota.pm                            []
 t/configure/testlib/init/kappa.pm                           []
 t/configure/testlib/init/zeta.pm                            []
 t/configure/testlib/inter/theta.pm                          []

Modified: branches/reconfigure/t/configure/042-fatal_step.t
==============================================================================
--- branches/reconfigure/t/configure/042-fatal_step.t   (original)
+++ branches/reconfigure/t/configure/042-fatal_step.t   Wed Oct  3 18:17:50 2007
@@ -18,7 +18,7 @@
 
 my $args = process_options(
     {
-        argv => [ qw( --fatal-step=init::iota ) ],
+        argv => [ qw( --fatal-step=init::zeta ) ],
         mode => q{configure},
     }
 );
@@ -28,8 +28,8 @@
 my $conf = Parrot::Configure->new;
 ok( defined $conf, "Parrot::Configure->new() returned okay" );
 
-my $step        = q{init::iota};
-my $description = 'Determining if your computer does iota';
+my $step        = q{init::zeta};
+my $description = 'Determining if your computer does zeta';
 
 $conf->add_steps($step);
 my @confsteps = @{ $conf->steps };

Modified: branches/reconfigure/t/configure/043-fatal_step.t
==============================================================================
--- branches/reconfigure/t/configure/043-fatal_step.t   (original)
+++ branches/reconfigure/t/configure/043-fatal_step.t   Wed Oct  3 18:17:50 2007
@@ -18,7 +18,7 @@
 
 my $args = process_options(
     {
-        argv => [ q{--fatal-step=init::iota,init::manifest} ],
+        argv => [ q{--fatal-step=init::zeta,init::manifest} ],
         mode => q{configure},
     }
 );
@@ -28,8 +28,8 @@
 my $conf = Parrot::Configure->new;
 ok( defined $conf, "Parrot::Configure->new() returned okay" );
 
-my $step        = q{init::iota};
-my $description = 'Determining if your computer does iota';
+my $step        = q{init::zeta};
+my $description = 'Determining if your computer does zeta';
 
 $conf->add_steps($step);
 my @confsteps = @{ $conf->steps };

Modified: branches/reconfigure/t/configure/044-fatal_step.t
==============================================================================
--- branches/reconfigure/t/configure/044-fatal_step.t   (original)
+++ branches/reconfigure/t/configure/044-fatal_step.t   Wed Oct  3 18:17:50 2007
@@ -18,7 +18,7 @@
 
 my $args = process_options(
     {
-        argv => [ qw( --fatal-step=foo::iota ) ],
+        argv => [ qw( --fatal-step=foo::zeta ) ],
         mode => q{configure},
     }
 );
@@ -28,8 +28,8 @@
 my $conf = Parrot::Configure->new;
 ok( defined $conf, "Parrot::Configure->new() returned okay" );
 
-my $step        = q{foo::iota};
-my $description = 'Determining if your computer does iota';
+my $step        = q{foo::zeta};
+my $description = 'Determining if your computer does zeta';
 
 $conf->add_steps($step);
 my @confsteps = @{ $conf->steps };

Added: branches/reconfigure/t/configure/048-return_undef.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/configure/048-return_undef.t Wed Oct  3 18:17:50 2007
@@ -0,0 +1,114 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 048-return_undef.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 14;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::IO::Capture::Mini;
+
+$| = 1;
+is($|, 1, "output autoflush is set");
+
+my $args = process_options( {
+    argv            => [ ],
+    mode            => q{configure},
+} );
+ok(defined $args, "process_options returned successfully");
+my %args = %$args;
+
+my $conf = Parrot::Configure->new;
+ok(defined $conf, "Parrot::Configure->new() returned okay");
+
+my $step = q{init::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$conf->add_steps( $step );
+my @confsteps = @{$conf->steps};
+isnt(scalar @confsteps, 0,
+    "Parrot::Configure object 'steps' key holds non-empty array reference");
+is(scalar @confsteps, 1,
+    "Parrot::Configure object 'steps' key holds ref to 1-element array");
+my $nontaskcount = 0;
+foreach my $k (@confsteps) {
+    $nontaskcount++ unless $k->isa("Parrot::Configure::Task");
+}
+is($nontaskcount, 0, "Each step is a Parrot::Configure::Task object");
+is($confsteps[0]->step, $step,
+    "'step' element of Parrot::Configure::Task struct identified");
+is(ref($confsteps[0]->params), 'ARRAY',
+    "'params' element of Parrot::Configure::Task struct is array ref");
+ok(! ref($confsteps[0]->object),
+    "'object' element of Parrot::Configure::Task struct is not yet a ref");
+
+$conf->options->set(%args);
+is($conf->options->{c}->{debugging}, 1,
+    "command-line option '--debugging' has been stored in object");
+
+my $rv;
+my (@lines, @errlines);
+{
+    my ($tie, $errtie);
+    $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    $errtie = tie *STDERR, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    $rv = $conf->runsteps;
+    @lines = $tie->READLINE;
+    @errlines = $errtie->READLINE;
+}
+untie *STDOUT;
+untie *STDERR;
+ok($rv, "runsteps successfully ran $step");
+my $bigmsg = join q{}, @lines;
+like($bigmsg,
+    qr/$description/s,
+    "Got correct description for $step");
+my $errmsg = join q{}, @errlines;
+like($errmsg,
+    qr/step $step failed:/,
+    "Got error message expected upon running $step");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+048-return_undef.t - see what happens when configuration step returns an
+undefined value
+
+=head1 SYNOPSIS
+
+    % prove t/configure/048-return_undef.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when your configuration step
+module returns something other than the object but has some other defined
+result method.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Modified: branches/reconfigure/t/configure/testlib/init/eta.pm
==============================================================================
--- branches/reconfigure/t/configure/testlib/init/eta.pm        (original)
+++ branches/reconfigure/t/configure/testlib/init/eta.pm        Wed Oct  3 
18:17:50 2007
@@ -24,11 +24,10 @@
     return \%data;
 }
 
-my $result = q|Hello world|;
+my $result = q|Goodbye, cruel world|;
 
 sub runstep {
     my ( $self, $conf ) = @_;
-    $self->set_result( $result );
     return;
 }
 

Reply via email to