Author: ericwilhelm
Date: Sun Feb 18 12:39:27 2007
New Revision: 9126

Modified:
   Module-Build/trunk/t/test_type.t
   Module-Build/trunk/t/test_types.t

Log:
test_type*.t - style cleanup, removed cargo-culting


Modified: Module-Build/trunk/t/test_type.t
==============================================================================
--- Module-Build/trunk/t/test_type.t    (original)
+++ Module-Build/trunk/t/test_type.t    Sun Feb 18 12:39:27 2007
@@ -2,7 +2,7 @@
 
 use strict;
 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 9;
+use MBTest tests => 8;
 
 use Cwd ();
 my $cwd = Cwd::cwd;
@@ -28,43 +28,45 @@
 
 use_ok 'Module::Build';
 
-SKIP: {
-  skip "no blib in core", 1 if $ENV{PERL_CORE};
-  like $INC{'Module/Build.pm'}, qr/\bblib\b/, "Make sure Module::Build was 
loaded from blib/";
-}
-
-
 # Here we make sure we can define an action that will test a particular type
 $::x = 0;
-my $mb = Module::Build->subclass
-  (
-   code => q#sub ACTION_testspecial { 
-    $::x++;
-    shift->generic_test(type => 'special');
-}#
-  )->new( module_name => $dist->name,
-          test_types  => { special => '.st' }
-  );
+my $mb = Module::Build->subclass(
+    code => q#
+        sub ACTION_testspecial { 
+            $::x++;
+            shift->generic_test(type => 'special');
+        }
+    #
+)->new(
+    module_name => $dist->name,
+    test_types  => { special => '.st' }
+);
 
 ok $mb;
 
 $mb->dispatch('testspecial');
-is( $::x, 1, "called once");
+is($::x, 1, "called once");
 
 
 $mb->add_to_cleanup('save_out');
 # Use uc() so we don't confuse the current test output
-my $verbose_output = uc(stdout_of( sub {$mb->dispatch('testspecial', verbose 
=> 1)} ));
+my $verbose_output = uc(stdout_of(
+    sub {$mb->dispatch('testspecial', verbose => 1)}
+));
 
-like $verbose_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m;
-like $verbose_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m;
+like($verbose_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m);
+like($verbose_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m);
 
 is( $::x, 2, "called again");
 
-my $output =  uc(stdout_of( sub {$mb->dispatch('testspecial', verbose => 0)} 
));
-like $output, qr/\.\.OK/;
+my $output = uc(stdout_of(
+    sub {$mb->dispatch('testspecial', verbose => 0)}
+));
+like($output, qr/\.\.OK/);
 
-is( $::x, 3, "called a third time");
+is($::x, 3, "called a third time");
 
 chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
 $dist->remove;
+
+# vim:ts=4:sw=4:et:sta

Modified: Module-Build/trunk/t/test_types.t
==============================================================================
--- Module-Build/trunk/t/test_types.t   (original)
+++ Module-Build/trunk/t/test_types.t   Sun Feb 18 12:39:27 2007
@@ -2,26 +2,24 @@
 
 use strict;
 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 14;
+use MBTest tests => 13;
 
 use Cwd ();
-my $cwd = Cwd::cwd;
-my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' );
+my $cwd = Cwd::cwd();
+my $tmp = File::Spec->catdir($cwd, 't', '_tmp');
 
 use DistGen;
 
+my $dist = DistGen->new(dir => $tmp);
 
-
-my $dist = DistGen->new( dir => $tmp );
-
-$dist->add_file('t/special_ext.st', <<'---' );
+$dist->add_file('t/special_ext.st', <<'---');
 #!perl 
 use Test::More tests => 2;
 ok(1, 'first test in special_ext');
 ok(1, 'second test in special_ext');
 ---
 
-$dist->add_file('t/another_ext.at', <<'---' );
+$dist->add_file('t/another_ext.at', <<'---');
 #!perl 
 use Test::More tests => 2;
 ok(1, 'first test in another_ext');
@@ -30,61 +28,71 @@
 
 $dist->regen;
 
-chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
+chdir($dist->dirname) or die "Can't chdir to '@{[$dist->dirname]}': $!";
 
 #########################
 
 use_ok 'Module::Build';
 
-SKIP: {
-  skip "no blib in core", 1 if $ENV{PERL_CORE};
-  like $INC{'Module/Build.pm'}, qr/\bblib\b/, "Make sure Module::Build was 
loaded from blib/";
-}
-
-
 my $mb = Module::Build->subclass(
    code => q#
-sub ACTION_testspecial { 
-    shift->generic_test(type => 'special');
-}
-
-sub ACTION_testanother { 
-    shift->generic_test(type => 'another');
-}
-#
-  )->new( module_name => $dist->name,
-          test_types  => { special => '.st',
-                           another => '.at',
-                         },
+        sub ACTION_testspecial { 
+            shift->generic_test(type => 'special');
+        }
+
+        sub ACTION_testanother { 
+            shift->generic_test(type => 'another');
+        }
+  #
+  )->new(
+      module_name => $dist->name,
+      test_types  => {
+          special => '.st',
+          another => '.at',
+      },
   );
 
 
 ok $mb;
 
-my $special_output = uc(stdout_of( sub {$mb->dispatch('testspecial', verbose 
=> 1)} ));
+my $special_output = uc(stdout_of(
+    sub {$mb->dispatch('testspecial', verbose => 1)}
+));
 
-like $special_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m, 'saw expected 
output from first test';
-like $special_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m, 'saw expected 
output from second test';
+like($special_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m,
+    'saw expected output from first test');
+like($special_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m,
+    'saw expected output from second test');
 
-my $another_output = uc(stdout_of( sub {$mb->dispatch('testanother', verbose 
=> 1)} ));
+my $another_output = uc(stdout_of(
+    sub {$mb->dispatch('testanother', verbose => 1)}
+));
 
-ok( $another_output, 'we have some test output' );
+ok($another_output, 'we have some test output');
 
-like $another_output, qr/^OK 1 - FIRST TEST IN ANOTHER_EXT/m, 'saw expected 
output from first test';
-like $another_output, qr/^OK 2 - SECOND TEST IN ANOTHER_EXT/m, 'saw expected 
output from second test';
+like($another_output, qr/^OK 1 - FIRST TEST IN ANOTHER_EXT/m,
+    'saw expected output from first test');
+like($another_output, qr/^OK 2 - SECOND TEST IN ANOTHER_EXT/m,
+    'saw expected output from second test');
 
 
-my $all_output = uc(stdout_of( sub {$mb->dispatch('testall', verbose => 1)} ));
+my $all_output = uc(stdout_of(
+    sub {$mb->dispatch('testall', verbose => 1)}
+));
 
-like $all_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m, 'expected output 
from basic.t';
-like $all_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m, 'expected output 
from basic.t';
+like($all_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m,
+    'expected output from basic.t');
+like($all_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m,
+    'expected output from basic.t');
 
-like $all_output, qr/^OK 1 - FIRST TEST IN ANOTHER_EXT/m;
-like $all_output, qr/^OK 2 - SECOND TEST IN ANOTHER_EXT/m;
+like($all_output, qr/^OK 1 - FIRST TEST IN ANOTHER_EXT/m);
+like($all_output, qr/^OK 2 - SECOND TEST IN ANOTHER_EXT/m);
 
-is( scalar( @{[  $all_output =~ m/(OK 1)/mg ]} ), 3 ); # we get a third one 
from basic.t
-is( scalar( @{[  $all_output =~ m/(OK)/mg ]} ),   8 );
+# we get a third one from basic.t
+is(scalar(@{[$all_output =~ m/(OK 1)/mg]}), 3 );
+is(scalar(@{[$all_output =~ m/(OK)/mg]}),   8 );
 
-chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
+chdir($cwd) or die "Can't chdir to '$cwd': $!";
 $dist->remove;
 
+# vim:ts=4:sw=4:et:sta

Reply via email to