[Bast-commits] r3744 - in local-lib/1.000/trunk: lib/local maint

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Sat Sep 15 21:45:42 GMT 2007


Author: matthewt
Date: 2007-09-15 21:45:42 +0100 (Sat, 15 Sep 2007)
New Revision: 3744

Modified:
   local-lib/1.000/trunk/lib/local/lib.pm
   local-lib/1.000/trunk/maint/gen-tests.pl
Log:
redid test setup to be sane pod-wise

Modified: local-lib/1.000/trunk/lib/local/lib.pm
===================================================================
--- local-lib/1.000/trunk/lib/local/lib.pm	2007-09-14 20:56:27 UTC (rev 3743)
+++ local-lib/1.000/trunk/lib/local/lib.pm	2007-09-15 20:45:42 UTC (rev 3744)
@@ -38,14 +38,18 @@
   }
 }
 
-=for test pipeline
+=begin testing
 
+#:: test pipeline
+
 package local::lib;
 
 { package Foo; sub foo { -$_[1] } sub bar { $_[1]+2 } sub baz { $_[1]+3 } }
 my $foo = bless({}, 'Foo');                                                 
 Test::More::ok($foo->${pipeline qw(foo bar baz)}(10) == -15);
 
+=end testing
+
 =cut
 
 sub resolve_path {
@@ -66,17 +70,23 @@
   }
 }
 
-=for test classmethod setup
+=begin testing
 
+#:: test classmethod setup
+
 my $c = 'local::lib';
 
-=cut
+=end testing
 
-=for test classmethod
+=begin testing
 
+#:: test classmethod
+
 is($c->resolve_empty_path, '~/perl5');
 is($c->resolve_empty_path('foo'), 'foo');
 
+=end testing
+
 =cut
 
 sub resolve_home_path {
@@ -120,11 +130,15 @@
   File::Spec->rel2abs($path);
 }
 
-=for test classmethod
+=begin testing
 
+#:: test classmethod
+
 local *File::Spec::rel2abs = sub { shift; 'FOO'.shift; };
 is($c->resolve_relative_path('bar'),'FOObar');
 
+=end testing
+
 =cut
 
 sub setup_local_lib_for {
@@ -236,8 +250,10 @@
   )
 }
 
-=for test classmethod
+=begin testing
 
+#:: test classmethod
+
 File::Path::rmtree('t/var/splat');
 
 $c->ensure_dir_structure_for('t/var/splat');
@@ -246,6 +262,8 @@
 
 ok(-f 't/var/splat/.modulebuildrc');
 
+=end testing
+
 =head1 NAME
 
 local::lib - create and use a local lib/ for perl modules with PERL5LIB

Modified: local-lib/1.000/trunk/maint/gen-tests.pl
===================================================================
--- local-lib/1.000/trunk/maint/gen-tests.pl	2007-09-14 20:56:27 UTC (rev 3743)
+++ local-lib/1.000/trunk/maint/gen-tests.pl	2007-09-15 20:45:42 UTC (rev 3744)
@@ -12,14 +12,28 @@
 
 sub mode::outer {
   shift;
-  if (shift =~ /^=for test (\S+)(?:\s+(\S+))?/) {
+  my $line = $_[0];
+  if ($line =~ /^=for test (\S+)(?:\s+(\S+))?/) {
     $mode = 'inner';
     ($test, $segment) = ($1, $2);
     $segment ||= '';
     $text = '';
+  } elsif ($line =~ /^=begin testing/) {
+    $mode = 'find_comment';
+    ($test, $segment, $text) = ('', '', '');
   }
 }
 
+sub mode::find_comment {
+  shift;
+  my $line = $_[0];
+  if ($line =~ /^\#\:\: test (\S+)(?:\s+(\S+))?/) {
+    $mode = 'inner';
+    ($test, $segment) = ($1, $2);
+    $segment ||= '';
+  }
+}
+
 sub mode::inner {
   shift;
   if ($_[0] =~ /^=/) {




More information about the Bast-commits mailing list