On Tuesday 15 April 2008 19:40:48 [EMAIL PROTECTED] wrote:

> Added:
>    trunk/t/steps/auto_macports-08.t
>       - copied, changed from r26997, /trunk/t/steps/auto_macports-07.t
> Modified:
>    trunk/MANIFEST
>    trunk/config/auto/macports.pm
>
> Log:
> Fix bug in auto::macports identified at Perl Seminar NY build fest by Jim
> Anderson:  case where there is no /opt/local/ directory yet.  Add 3
> additional test files to exercise this case.

We need *three* test files to exercise a *single* case?  There are 215 test 
files in t/steps/ and 72 test files in t/configure/.  How much duplication 
are we carrying around in all of these files?

Here's the functional diff between t/steps/auto_macports-06.t and 
t/steps/auto_macports-07.t:

--- t/steps/auto_macports-06.t  2008-04-15 19:46:25.000000000 -0700
+++ t/steps/auto_macports-07.t  2008-04-15 19:46:25.000000000 -0700
@@ -11,7 +11,6 @@
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
-$ENV{TEST_MACPORTS} = 'foobar';
 use_ok('config::auto::macports');
 
 use Parrot::Configure;
@@ -40,7 +39,8 @@
 isa_ok($step, $step_name);
 ok($step->description(), "$step_name has description");
 
-# mock no Macports-default directories
+# mock no Macports root directory
+$step->{ports_root} = undef;
 ok($step->runstep($conf), "runstep() returned true value");
 is($step->result(), 'no', "Got expected result");

Here's the functional diff between t/steps/auto_macports-07.t and 
t/steps/auto_macports-08.t:

--- t/steps/auto_macports-07.t  2008-04-15 19:46:25.000000000 -0700
+++ t/steps/auto_macports-08.t  2008-04-15 19:46:25.000000000 -0700
@@ -1,13 +1,13 @@
 #! perl
 # Copyright (C) 2007, The Perl Foundation.
-# $Id: /mirror/trunk/t/steps/auto_macports-07.t 27004 
2008-04-16T02:32:04.905804Z jkeenan  $
-# auto_macports-07.t
+# $Id: /mirror/trunk/t/steps/auto_macports-08.t 27005 
2008-04-16T02:40:47.421967Z jkeenan  $
+# auto_macports-08.t
 
 use strict;
 use warnings;
 use Test::More;
 plan( skip_all => 'Macports is Darwin only' ) unless $^O =~ /darwin/;
-plan( tests => 12 );
+plan( tests => 13 );
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
@@ -16,9 +16,10 @@
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
 use Parrot::Configure::Test qw( test_step_thru_runstep);
+use IO::CaptureOutput qw( capture );
 
 my $args = process_options( {
-    argv            => [],
+    argv            => [ q{--verbose} ],
     mode            => q{configure},
 } );
 
@@ -41,8 +42,17 @@
 
 # mock no Macports root directory
 $step->{ports_root} = undef;
-ok($step->runstep($conf), "runstep() returned true value");
-is($step->result(), 'no', "Got expected result");
+{
+    my ($stdout, $stderr);
+    my $ret = capture sub { $step->runstep($conf) }, \$stdout, \$stderr;
+    ok($ret, "runstep() returned true value");
+    is($step->result(), 'no', "Got expected result");
+    like(
+        $stdout,
+        qr/^Could not locate Macports root directory/,
+        "Got expected verbose output"
+    );
+}

Effectively speaking, 07 and 08 each contain only *one* interesting test.  The 
rest is repetition.

These three files should be a single test file.  I suspect the same is true of 
many of the other 287 test files in t/steps and t/config.

-- c

Reply via email to