Pod::Tests 0.05 is winging its way to CPAN.  This version gives us
pretty much the complete interface.
http://www.pobox.com/~schwern/src/Pod-Tests-0.05.tar.gz if its not
already on CPAN.

0.05  Fri Jun 29 22:01:33 EDT 2001
    * Greatly extended the abilities of testing example code.

0.04  Fri Jun 29 20:10:29 EDT 2001      *UNRELEASED*
    - Fixed a bug with pod2test puking if there's no tests
    - Added RFC 183 into the dist.
    - Fixed up testing of example code

What this means is you can now fully test the code examples in your
docs.  Excerpt from the man page below.

       Code Examples EXPERIMENTAL

       BIG FAT WARNING perldoc and the various pod2* reformatters
       are inconsistant in how they deal with =also.  Some warn,
       some display it, some choke.  So consider this to be a
       Highly Experimental Feature.  Also, this interface is
       EXPERIMENTAL AND SUBJECT TO CHANGE!

       Code examples in documentation are rarely tested.
       Pod::Tests provides a way to do some testing of your exam-
       ples without repeating them.

       A code example is denoted using either "=also for example"
       or an "=also begin/end example" block.

       The "=also" tag provides that examples will both be
       extracted and displayed as documentation.

           =also for example
           print "Here is a fine example of something or other.";

           =also begin example

           use LWP::Simple;
           getprint "http://www.goats.com";;

           =also end example

       Using a normal "=for example" or "=begin/end example"
       block lets you add code to your example that won't get
       displayed.  This is nice when you only want to show a code
       fragment, yet still want to ensure things work.

           =for example
           sub mygrep (&@) { }

           =also for example
           mygrep { $_ eq 'bar' } @stuff

       The mygrep() call would be a syntax error were the routine
       not declared with the proper prototype.  Pod::Tests will
       consider both pieces to the part of the same example for
       the purposes of testing, but will only display the "mygrep
       {...}" line.  You can also put "=for example" blocks
       afterwards.

       You can also put a "=for example testing" afterwards:

           =also for example
             my $result = 2 + 2;

           =for example_testing
             ok( $result == 4,         'addition works' );

       It will work like any other embedded test.  In this case
       the code will actually be run.

       Finally, since many examples print their output, we trap
       that into $_STDOUT_ and $_STDERR_ variables to capture
       prints and warnings.

           =also for example
             print "Hello, world!\n";
             warn  "Beware the Ides of March!\n";

           =for example_testing
             ok( $_STDOUT_ eq "Hello, world!\n" );
             ok( $_STDERR_ eq "Beware the Ides of March!\n" );

       Remember, this is all EXPERIMENTAL and SUBJECT TO CHANGE!


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
I'm exploring my nipples.

Reply via email to