[svn:parrot] r37149 - trunk/t/steps

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat Mar 7 00:50:12 UTC 2009


Author: jkeenan
Date: Sat Mar  7 00:50:11 2009
New Revision: 37149
URL: https://trac.parrot.org/parrot/changeset/37149

Log:
Add tests for verbose output.

Modified:
   trunk/t/steps/auto_neg_0-01.t

Modified: trunk/t/steps/auto_neg_0-01.t
==============================================================================
--- trunk/t/steps/auto_neg_0-01.t	Sat Mar  7 00:35:48 2009	(r37148)
+++ trunk/t/steps/auto_neg_0-01.t	Sat Mar  7 00:50:11 2009	(r37149)
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 19;
+use Test::More tests => 31;
 use Carp;
 
 use lib qw( lib t/configure/testlib );
@@ -66,17 +66,69 @@
 
 $d_neg_0 = '-0';
 
-ok( $step->_evaluate_cc_run($conf, $d_neg_0, $orig_has_neg_0, $verbose),
+is( $step->_evaluate_cc_run($conf, $d_neg_0, $orig_has_neg_0, $verbose),
+    1,
     '_evaluate_cc_run() completed satisfactorily' );
 
 is( $step->result(), 'yes', 'Got expected result');
 
 $d_neg_0 = '0';
 
-ok( !$step->_evaluate_cc_run($conf, $d_neg_0, $orig_has_neg_0, $verbose),
+is( $step->_evaluate_cc_run($conf, $d_neg_0, $orig_has_neg_0, $verbose),
+    0,
     '_evaluate_cc_run() completed satisfactorily' );
 is( $step->result(), 'no', 'Got expected result' );
 
+$conf->replenish($serialized);
+
+########## --verbose; _evaluate_cc_run() ##########
+
+($args, $step_list_ref) = process_options( {
+    argv => [ q{--verbose} ],
+    mode => q{configure},
+} );
+rerun_defaults_for_testing($conf, $args );
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+$step = test_step_constructor_and_description($conf);
+
+$verbose = $conf->options->get('verbose');
+my $has_neg_0;
+
+$d_neg_0 = '-0';
+{
+    my ($stdout, $stderr);
+    capture(
+        sub {
+            $has_neg_0 = $step->_evaluate_cc_run(
+                $conf, $d_neg_0, $orig_has_neg_0, $verbose
+            ),
+        },
+        \$stdout,
+    );
+    is( $has_neg_0, 1,
+        'Got expected return value from _evaluate_cc_run()' );
+    is( $step->result(), 'yes', 'Got expected result: yes' );
+    like( $stdout, qr/\(yes\)/, 'Got expected verbose output' );
+}
+
+$d_neg_0 = '0';
+{
+    my ($stdout, $stderr);
+    capture(
+        sub {
+            $has_neg_0 = $step->_evaluate_cc_run(
+                $conf, $d_neg_0, $orig_has_neg_0, $verbose
+            ),
+        },
+        \$stdout,
+    );
+    is( $has_neg_0, 0,
+        'Got expected return value from _evaluate_cc_run()' );
+    is( $step->result(), 'no', 'Got expected result: no' );
+    like( $stdout, qr/\(no\)/, 'Got expected verbose output' );
+}
+
 pass("Completed all tests in $0");
 
 ################### DOCUMENTATION ###################


More information about the parrot-commits mailing list