- Test::Class
Test::Class simple example
- use the Test attribute to mark a function as test
examples/test-class/t/lib/MyApp.pm
package t::lib::MyApp; use strict; use warnings; use base 'Test::Class'; use Test::More; use MyApp qw(add); sub test_add : Test { is add(2, 3), 5; } 1;
examples/test-class/t/01-test-myapp.t
use strict; use warnings; use lib '.'; use t::lib::MyApp; Test::Class->runtests;