You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

6.15. Test::Builder

Example 6-10. examples/intro/Test/MyTest.pm

package Test::MyTest;
use strict;
use warnings;


use base 'Exporter';
our @EXPORT_OK = qw(my_test);

use Test::Builder;

my $Test = Test::Builder->new;


sub my_test {
    my ($x, $op, $y, $expected) = @_;
    
    my $result;
    if ($op eq '+') {
        $result = $x + $y;
    } else {
        die "Not yet implemented";
    }


    $Test->is_num($result, $expected);
}


1;

Test modules created using Test::Builder all work nicely together. Among other things, they don't get confused with the counting of the tests.

Test::Simple, Test::More, Test::Exception, Test::Differences all use Test::Builder as a back-end.


If you are interested in on-site trainings by the author, please contact me directly.