This is the version of Pod::Tests that I feverishly patched together
at TPC just before my talk.

The important thing here is that tests will now report the line number
where it was originally written, and not the generated test file.  So
if you embed a test on line 45 of Foo.pm and it fails, it will say
"Test failed at line 45 of Foo.pm".

Pod::Tests will be renamed to Test::Inline.  Less confusing, easier to
find.  Pod::Tests will remain as a legacy wrapper.  For most people,
this won't make any difference.  pod2test will remain pod2test.

The other important thing is in the next version, tests will be
lexically isolated.  This means you can't do this sort of thing
anymore:

    =for testing
    my $foo = 23;
    is( $foo--, 23 );

    blah blah blah

    =for testing
    is( $foo, 22 );

Since this will generate a test file roughly like so:

    {
        my $foo = 23;
        is( $foo--, 23 );
    }

    {
        is( $foo, 22 );
    }

I originally didn't want to do this, but after playing with Pod::Tests
some more I realized it was a good idea.  If you want to share
variables amongst tests, just use globals.

So check through your tests now to make sure you're not relying on
shared lexicals.  Simplest thing to do is apply this patch:

--- lib/Pod/Tests.pm    13 Aug 2001 21:00:31 -0000      1.12
+++ lib/Pod/Tests.pm    13 Aug 2001 22:03:44 -0000
@@ -489,8 +489,10 @@
     foreach my $test (@tests) {
         my $file = $self->{file} || '';
         push @code, <<CODE;
+{
 #line $test->{line} $file
 $test->{code}
+}
 CODE
 
     }


and see if things still work.



0.08  Mon Aug 13 16:48:50 EDT 2001
    * Now reporting the line numbers of the orignal POD entries in tests
    * Put in warning about tests being lexically isolated next version.
    - Documented that "=also for example" will never work
    - fixed bug with tests at the very end of the file



-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
Pancakes is the better part of valor.
        http://www.goats.com/archive/971202.html

Reply via email to