From Test::Simple to Test::Extreme - Embedding Tests in Your Code 24

Embedding Tests in Pod

  • How many of us write documentation?

  • in Pod?

  • Test::Inline (formerly Pod::Tests) lets you embed simple tests in your documentation:

             =head1 DIAGNOSTIC SUBROUTINES
    
             =over 4
    
             =item verify_min_max
    
             This subroutine returns true if the given value is between a
             minimum and a maximum value, and false otherwise.
    
                 verify_min_max($value, $min, $max) or die "Value is out of range!\n";
    
             =cut
    
             sub verify_min_max {
                 my ($actual, $min, $max) = @_;
                 return 1 if $actual <= $max and $actual >= $min;
                 return;
             }
    
    

 

YAPC::CA << Previous | Index | Next >>
Copyright © 2003 Michael Graham