Author: jkeenan
Date: Sun Sep 30 13:33:28 2007
New Revision: 21681

Added:
   branches/reconfigure/t/configure/044-fatal_step.t   (contents, props changed)
Modified:
   branches/reconfigure/t/configure/042-fatal_step.t
   branches/reconfigure/t/configure/043-fatal_step.t

Log:
Add third test file, 044-fatal_step.t, for purpose of testing --fatal-step
option:  What happens when value for that option is misspecified?  Semantic
cleanups in POD for two other test files.


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   Sun Sep 30 13:33:28 2007
@@ -95,7 +95,7 @@
 
 The files in this directory test functionality used by F<Configure.pl>.
 
-The tests in this file examine what happens when set the C<--fatal-step>
+The tests in this file examine what happens when you set the C<--fatal-step>
 option for a single configuration step and that step returns an undefined
 value.
 

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   Sun Sep 30 13:33:28 2007
@@ -95,7 +95,7 @@
 
 The files in this directory test functionality used by F<Configure.pl>.
 
-The tests in this file examine what happens when set the C<--fatal-step>
+The tests in this file examine what happens when you set the C<--fatal-step>
 option for multiple configuration steps and one of those steps returns an
 undefined value.
 

Added: branches/reconfigure/t/configure/044-fatal_step.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/configure/044-fatal_step.t   Sun Sep 30 13:33:28 2007
@@ -0,0 +1,95 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 044-fatal_step.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 12;
+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 => [ qw( --fatal-step=foo::iota ) ],
+        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{foo::iota};
+my $description = 'Determining if your computer does iota';
+
+$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;
+eval { $rv = $conf->runsteps; };
+like($@, qr/^Argument to 'fatal-step' option/,
+    "Got expected error message when value to --fatal-step option was 
misspecified");
+
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+044-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+    % prove t/configure/044-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you misspecify the value for
+the C<--fatal-step> option.
+
+=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:
+

Reply via email to