NAME

Test::NaiveStubs - Generate test stubs for methods

VERSION

version 0.0200

SYNOPSIS

use Test::NaiveStubs;
my $tns = Test::NaiveStubs->new(
  class => 'Foo::Bar',
  name  => 't/foo-bar.t',
);
$tns->create_test;

DESCRIPTION

A Test::NaiveStubs generates a test file of stubs for exercising all the methods (not functions) of a given class.

For a more powerful alternative, check out Test::StubGenerator.

ATTRIBUTES

class

The class name to use in the test generation.

name

The test output file name. If not given in the constructor, the filename is created from the class. So Foo::Bar would be converted to foo-bar.t.

METHODS

new()

$tns = Test::NaiveStubs->new(%arguments);

Create a new Test::NaiveStubs object.

gather_methods()

$methods = $tns->gather_methods;

Return the methods of the given class as a hash reference.

unit_test()

$test = $tns->unit_test($method);

Return the text of a method unit test.

create_test()

$tns->create_test;

Create a test file with unit tests for each method.

SEE ALSO

Moo

Class::Sniff

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.