Author: jkeenan
Date: Sun Sep 30 18:39:00 2007
New Revision: 21693

Added:
   branches/reconfigure/t/configure/045-fatal_step.t   (contents, props changed)
   branches/reconfigure/t/configure/testlib/init/kappa.pm   (contents, props 
changed)
Modified:
   branches/reconfigure/MANIFEST

Log:
Add fourth test file, 045-fatal_step.t, for purpose of testing --fatal-step
option:  What happens when value for that option is correctly specified but
you are running a different configuration step?  Also:  add
pseudo-configuration step class init::kappa.


Modified: branches/reconfigure/MANIFEST
==============================================================================
--- branches/reconfigure/MANIFEST       (original)
+++ branches/reconfigure/MANIFEST       Sun Sep 30 18:39:00 2007
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Sep 30 20:20:48 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Oct  1 01:31:02 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2955,6 +2955,8 @@
 t/configure/040-return_undef.t                              []
 t/configure/042-fatal_step.t                                []
 t/configure/043-fatal_step.t                                []
+t/configure/044-fatal_step.t                                []
+t/configure/045-fatal_step.t                                []
 t/configure/101-init_manifest.01.t                          []
 t/configure/101-init_manifest.02.t                          []
 t/configure/102-init_defaults.01.t                          []
@@ -3043,6 +3045,7 @@
 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                          []
 t/distro/file_metadata.t                                    []

Added: branches/reconfigure/t/configure/045-fatal_step.t
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/configure/045-fatal_step.t   Sun Sep 30 18:39:00 2007
@@ -0,0 +1,105 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 045-fatal_step.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 13;
+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=init::alpha ) ],
+        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::kappa};
+my $description = 'Determining if your computer does kappa';
+
+$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 ( $tie, @lines );
+{
+    $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    $rv    = $conf->runsteps;
+    @lines = $tie->READLINE;
+}
+ok($rv, "runsteps() returned true value");
+my $bigmsg = join q{}, @lines;
+like(
+    $bigmsg,
+    qr/$description\.\.\./s,
+    "Got STDOUT message expected upon running $step"
+);
+
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+045-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+    % prove t/configure/045-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 a valid value is specified 
for the C<--fatal-step> but a different configuration step is run.
+
+=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:
+

Added: branches/reconfigure/t/configure/testlib/init/kappa.pm
==============================================================================
--- (empty file)
+++ branches/reconfigure/t/configure/testlib/init/kappa.pm      Sun Sep 30 
18:39:00 2007
@@ -0,0 +1,39 @@
+# Copyright (C) 2001-2003, The Perl Foundation.
+# $Id$
+
+=head1 NAME
+
+t/configure/testlib/init/kappa.pm - Module used in configuration tests
+
+=cut
+
+package init::kappa;
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step::Base);
+
+use Parrot::Configure::Step;
+
+sub _init {
+    my $self = shift;
+    my %data;
+    $data{description} = 'Determining if your computer does kappa';
+    $data{args}        = [  ];
+    $data{result}      = q{};
+    return \%data;
+}
+
+sub runstep {
+    my ( $self, $conf ) = @_;
+    return 1;
+}
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Reply via email to