Test::UsageTest::Usage is a different approach to testing: selective, quieter, colorful. | |
Download |
Test::Usage Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Luc St-Louis
- Publisher web site:
- http://search.cpan.org/~lucs/Test-Usage-0.07/lib/Test/Usage.pm
Test::Usage Tags
Test::Usage Description
Test::Usage is a different approach to testing: selective, quieter, colorful. Test::Usage is a different approach to testing: selective, quieter, colorful.SYNOPSISLet's say we are building module Foo.pm. To exercise it, we write a usage examples module, Foo_T.pm, which may eventually look something like this: package Foo_T; use Test::Usage; use strict; use warnings; use Foo; example('e1', sub { ... ok(...); ... die "Uh oh"; ... }); example('a1', sub { ... ok(...) or diag(...); ... }); example('a2', sub { ... ok(...); ... }); example('a3', sub { my $f = Foo->new(); my $got_foo = $f->foo(); my $exp_foo = 'FOO'; ok( $got_foo eq $exp_foo, "Expecting foo() to return '$exp_foo'.", "But got '$got_foo'." ); });Here are a few ways to test its examples: # Run example 'a3' only. perl -MFoo_T -e 'test(a => "a3")' # Run all examples whose label matches glob 'a*': a1, a2, a3. perl -MFoo_T -e 'test(a => "a*")' # Run all examples found in the test module. perl -MFoo_T -e test # Run example 'a3', reporting successes also, but without color. perl -MFoo_T -e 'test(a => "a3", v => 2, c => 0)' # Run and summarize all examples in all "*_T.pm" files found under # current directory. perl -MTest::Usage -e files Requirements: · Perl
Test::Usage Related Software