Author: jkeenan
Date: Fri Jul 25 18:15:53 2008
New Revision: 29742

Modified:
   branches/parallel/config/gen/config_pm.pm
   branches/parallel/t/steps/gen_config_pm-01.t

Log:
Provide basic tests.  Move list of required template files into _init(), then
test for their presence.


Modified: branches/parallel/config/gen/config_pm.pm
==============================================================================
--- branches/parallel/config/gen/config_pm.pm   (original)
+++ branches/parallel/config/gen/config_pm.pm   Fri Jul 25 18:15:53 2008
@@ -29,6 +29,11 @@
     my %data;
     $data{description} = q{Recording configuration data for later retrieval};
     $data{result}      = q{};
+    $data{templates}    = {
+        myconfig        => 'config/gen/config_pm/myconfig.in',
+        Config_pm       => 'config/gen/config_pm/Config_pm.in',
+        config_lib      => 'config/gen/config_pm/config_lib.in',
+    };
     return \%data;
 }
 
@@ -37,9 +42,9 @@
 
     $conf->data->clean;
 
-    $conf->genfile('config/gen/config_pm/myconfig.in', 'myconfig' );
+    $conf->genfile($self->{templates}->{myconfig}, 'myconfig' );
 
-    open( my $IN, "<", "config/gen/config_pm/Config_pm.in" )
+    open( my $IN, "<", $self->{templates}->{Config_pm} )
         or die "Can't open Config_pm.in: $!";
 
     my $configdir = catdir(qw/lib Parrot Config/);
@@ -63,8 +68,8 @@
     close $IN  or die "Can't close Config_pm.in: $!";
     close $OUT or die "Can't close Config.pm: $!";
 
-    my $template = "config/gen/config_pm/config_lib.in";
-    open( $IN,  "<", $template )         or die "Can't open '$template': $!";
+    my $template = $self->{templates}->{config_lib};
+    open( $IN,  "<", $template ) or die "Can't open '$template': $!";
     my $c_l_pasm = q{config_lib.pasm};
     $conf->append_configure_log($c_l_pasm);
     open( $OUT, ">", $c_l_pasm ) or die "Can't open $c_l_pasm: $!";

Modified: branches/parallel/t/steps/gen_config_pm-01.t
==============================================================================
--- branches/parallel/t/steps/gen_config_pm-01.t        (original)
+++ branches/parallel/t/steps/gen_config_pm-01.t        Fri Jul 25 18:15:53 2008
@@ -5,40 +5,36 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  10;
+use Test::More qw(no_plan); # tests =>   9;
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
 use_ok('config::gen::config_pm');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::Configure::Test qw(
+    test_step_thru_runstep
+    test_step_constructor_and_description
+);
+
+my $args = process_options(
+    {
+        argv => [ ],
+        mode => q{configure},
+    }
+);
 
-my $args = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-
-my $conf = Parrot::Configure->new();
-
-test_step_thru_runstep($conf, q{init::defaults}, $args);
-
-my ($task, $step_name, $step, $ret);
+my $conf = Parrot::Configure->new;
 my $pkg = q{gen::config_pm};
-
 $conf->add_steps($pkg);
-$conf->options->set(%{$args});
-$task = $conf->steps->[-1];
-$step_name   = $task->step;
-
-$step = $step_name->new();
-ok(defined $step, "$step_name constructor returned defined value");
-isa_ok($step, $step_name);
-ok($step->description(), "$step_name has description");
-
-# Test of runstep() not yet ready for prime time.
-# ok($step->runstep($conf), "runstep() returned true value");
-
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+ok(-f $step->{templates}->{myconfig},
+    "Able to locate template for myconfig");
+ok(-f $step->{templates}->{Config_pm},
+    "Able to locate template for Config_pm");
+ok(-f $step->{templates}->{config_lib},
+    "Able to locate template for config_lib");
 
 pass("Completed all tests in $0");
 

Reply via email to