[svn:parrot] r49724 - in branches/gsoc_nci/t/steps: auto gen

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Fri Oct 29 01:56:28 UTC 2010


Author: jkeenan
Date: Fri Oct 29 01:56:27 2010
New Revision: 49724
URL: https://trac.parrot.org/parrot/changeset/49724

Log:
Refine two configuration step test files.

Modified:
   branches/gsoc_nci/t/steps/auto/libffi-01.t
   branches/gsoc_nci/t/steps/gen/libffi-01.t

Modified: branches/gsoc_nci/t/steps/auto/libffi-01.t
==============================================================================
--- branches/gsoc_nci/t/steps/auto/libffi-01.t	Fri Oct 29 01:56:04 2010	(r49723)
+++ branches/gsoc_nci/t/steps/auto/libffi-01.t	Fri Oct 29 01:56:27 2010	(r49724)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 9;
+use Test::More tests => 19;
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::auto::libffi');
@@ -13,7 +13,7 @@
 use Parrot::Configure::Step::Test;
 use Parrot::Configure::Test qw(
     test_step_constructor_and_description
-    );
+);
 
 use IO::CaptureOutput qw| capture |;
 
@@ -37,9 +37,46 @@
 $conf->options->set(%{$args});
 $step = test_step_constructor_and_description($conf);
 
-$step->runstep($conf);
-is( $step->result(), q{yes}, "Got expected result" );
-is( $conf->data->get( 'HAS_LIBFFI' ), 1, "Got expected value for 'libffi'" );
+ok( $step->runstep($conf), 'runstep() returned true value' );
+like( $step->result(), qr/^yes|no$/, "Result was set" );
+like( $conf->data->get( 'HAS_LIBFFI' ),
+    qr/^1|0$/,
+    "Plausible value for 'HAS_LIBFFI'"
+);
+# Prepare for next tests
+$step->set_result( undef );
+$conf->data->set( HAS_LIBFFI => undef );
+
+$conf->replenish($serialized);
+
+########## --verbose ##########
+
+($args, $step_list_ref) = process_options( {
+    argv => [ q{--verbose} ],
+    mode => q{configure},
+} );
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+$step = test_step_constructor_and_description($conf);
+{
+    my $stdout;
+    my $ret = capture(
+        sub { $step->runstep($conf) },
+        \$stdout
+    );
+    ok( $ret, "runstep() returned true value" );
+    like( $step->result(), qr/^yes|no$/, "Result was set" );
+    like( $conf->data->get( 'HAS_LIBFFI' ),
+        qr/^1|0$/,
+        "Plausible value for 'HAS_LIBFFI'"
+    );
+    ok( $stdout, 'Some verbose output captured' );
+}
+# Prepare for next tests
+$step->set_result( undef );
+$conf->data->set( HAS_LIBFFI => undef );
+
+########## --without-libffi ##########
 
 ($args, $step_list_ref) = process_options( {
         argv            => [ q{--without-libffi} ],
@@ -50,7 +87,13 @@
 $step->runstep($conf);
 is( $step->result(), q{no}, "Got expected result" );
 is( $conf->data->get( 'HAS_LIBFFI' ), 0,
-    "'libffi' undefined as expected" );
+    "'libffi' set to false value as expected" );
+
+ok(auto::libffi::_evaluate_cc_run('libffi worked'),
+    "'_evaluate_cc_run able to return true value");
+
+ok(! auto::libffi::_evaluate_cc_run('libffi did not worked'),
+    "'_evaluate_cc_run able to return false value");
 
 pass("Completed all tests in $0");
 

Modified: branches/gsoc_nci/t/steps/gen/libffi-01.t
==============================================================================
--- branches/gsoc_nci/t/steps/gen/libffi-01.t	Fri Oct 29 01:56:04 2010	(r49723)
+++ branches/gsoc_nci/t/steps/gen/libffi-01.t	Fri Oct 29 01:56:27 2010	(r49724)
@@ -5,13 +5,13 @@
 
 use strict;
 use warnings;
-use Test::More tests => 12;
+use Test::More qw(no_plan); # tests => 12;
 use Carp;
 use Cwd;
-use File::Copy;
-use File::Path qw( mkpath );
-use File::Temp qw( tempdir );
-use File::Spec;
+#use File::Copy;
+#use File::Path qw( mkpath );
+#use File::Temp qw( tempdir );
+#use File::Spec;
 use lib qw( lib );
 use_ok('config::gen::libffi');
 use Parrot::Configure::Options qw( process_options );
@@ -19,12 +19,28 @@
 use Parrot::Configure::Test qw(
     test_step_constructor_and_description
 );
-use Parrot::Configure::Utils qw( _slurp );
-use IO::CaptureOutput qw( capture );
+#use Parrot::Configure::Utils qw( _slurp );
+#use IO::CaptureOutput qw( capture );
 
 ########## regular ##########
 
-sub
+#sub
+
+my ($args, $step_list_ref) = process_options(
+    {
+        argv => [ ],
+        mode => q{configure},
+    }
+);
+
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
+
+my ($pkg, $step, $result);
+$pkg = q{gen::libffi};
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+$step = test_step_constructor_and_description($conf);
 
 pass("Completed all tests in $0");
 


More information about the parrot-commits mailing list