VERSION
Version 0.34
DESCRIPTION
Emits Perl test code for a set of method schemas and their associated test plans. Each method plan is translated into one or more test blocks using Test::Most. The emitted code is returned as a string ready to be written to a .t file.
new
Construct a new Perl emitter.
my $emitter = App::Test::Generator::Emitter::Perl->new(
schema => \%schemas,
plans => \%plans,
package => 'My::Module',
);
Arguments
schemaA hashref of method name to schema hashref. Required.
plansA hashref of method name to test plan hashref, as produced by App::Test::Generator::TestStrategy or App::Test::Generator::Planner. Required.
packageThe Perl package name of the module under test. Required.
Returns
A blessed hashref. Croaks if any required argument is missing.
API specification
input
{
schema => { type => HASHREF },
plans => { type => HASHREF },
package => { type => SCALAR },
}
output
{
type => OBJECT,
isa => 'App::Test::Generator::Emitter::Perl',
}
emit
Generate and return the complete Perl test file source as a string, including the file header, one test block per method, and the done_testing() footer.
my $emitter = App::Test::Generator::Emitter::Perl->new(
schema => \%schemas,
plans => \%plans,
package => 'My::Module',
);
my $test_code = $emitter->emit;
write_file('t/generated.t', $test_code);
Arguments
None beyond $self.
Returns
A string containing the complete Perl test file source.
API specification
input
{
self => { type => OBJECT, isa => 'App::Test::Generator::Emitter::Perl' },
}
output
{ type => SCALAR }