Test::Functional

Perl tests in a functional style
Download

Test::Functional Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Erik Andreas Osheim
  • Publisher web site:
  • http://search.cpan.org/~erik/

Test::Functional Tags


Test::Functional Description

Perl tests in a functional style Test::Functional is a Perl module that uses the ability to create new syntax via perl prototypes to create a testing system focused on functions rather than values. Tests run blocks of Perl, and use comparator functions to test the output. Despite being a different way of thinking about tests, it plays well with Test::More and friends.SYNOPSIS use Test::Functional; # make sure the bomb goes off sub explode { die "BOOM" } test { explode() } dies, "test-3"; # implicit and explicit equivalence test { 2 * 2 } 4, "test-1"; test { 2 * 2 } eqv 4, "test-1"; # test blocks can be as simple or as involved as you want test { 3 > 0 } true, "test-4"; test { my $total = 0; foreach my $person ($car->occupants) { $total += $person->weight } $total < 600 } true, "test-5"; # after the test runs, you also get the result. my $horse = test { Horse->new } typeqv "Horse", "test-6"; # you can make your own comparator functions, or use existing ones. use Test::More import => ; sub islike { my ($other) = @_; return sub { my ($got, $testname) = @_; like($got, $other, $testname); }; } test { 'caterpillar' } islike(qr/cat/), 'is cat?'; Requirements: · Perl


Test::Functional Related Software