Author: jkeenan
Date: Fri Oct  5 04:37:47 2007
New Revision: 21886

Modified:
   branches/reconfigure/lib/Parrot/Configure.pm
   branches/reconfigure/t/configure/051-list_of_steps.t

Log:
Add code to cause Parrot::Configure::get_list_of_steps to die if the
underlying data is not yet available.  Add corresponding test to
051-list_of_steps.t.


Modified: branches/reconfigure/lib/Parrot/Configure.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Configure.pm        (original)
+++ branches/reconfigure/lib/Parrot/Configure.pm        Fri Oct  5 04:37:47 2007
@@ -156,6 +156,8 @@
 
 sub get_list_of_steps {
     my $conf = shift;
+    die "list_of_steps not available until steps have been added"
+        unless defined $conf->{list_of_steps};
     return wantarray ? @{ $conf->{list_of_steps} } : $conf->{list_of_steps};
 }
 

Modified: branches/reconfigure/t/configure/051-list_of_steps.t
==============================================================================
--- branches/reconfigure/t/configure/051-list_of_steps.t        (original)
+++ branches/reconfigure/t/configure/051-list_of_steps.t        Fri Oct  5 
04:37:47 2007
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests =>  5;
+use Test::More tests =>  6;
 use Carp;
 use lib qw( lib t/configure/testlib );
 use Parrot::Configure;
@@ -24,8 +24,16 @@
 ok(defined $conf, "Parrot::Configure->new() returned okay");
 
 my $first_step = q{init::zeta};
-
 my @official_steps = get_steps_list();
+
+eval {
+    $conf->get_list_of_steps();
+};
+like ($@,
+    qr/^list_of_steps not available until steps have been added/,
+    "Got expected failure message when get_list_of_steps called too early"
+);
+
 $conf->add_steps( $first_step, @official_steps );
 my @list_of_steps = $conf->get_list_of_steps();
 is_deeply( [ ( $first_step, @official_steps ) ], [ @list_of_steps ],

Reply via email to