DESCRIPTION

This class is where the heavy lifting happens to actually generating a test file takes place. Given a source filename, this modules will load it, parse out the relavent bits, put them into order based on the tags, and then merge them into a test file.

METHODS

new

  my $File = Test::Inline::Script->new( $class, \@sections, $check_count );

The \*(C`new\*(C' constructor takes a class name, set of Section objects and an optional \*(C`check_count\*(C' flag.

Returns a Test::Inline::Script object on success. Returns \*(C`undef\*(C' on error.

class

Returns the class that the test file will test

filename

my $filename = $File->filename;

The \*(C`filename\*(C' method returns the name of the output file that the tests should be written to. For example, the class \*(C`Foo::Bar\*(C' would have the filename value \*(C`foo_bar.t\*(C'.

config

my $config = $File->config;

The \*(C`config\*(C' method returns the config object for the file, assuming that it has one. If more than one are found, the first will be used, and any additional config sections discarded.

Returns a Test::Inline::Config object on success, or false if the file does not contain a config section.

setup

my @setup = $File->setup;

The \*(C`setup\*(C' method returns the setup sections from the file, in the same order as in the file.

Returns a list of setup Test::Inline::Section objects, the null array \*(C`()\*(C' if the file does not contain any setup objects.

sections

my @sections = $File->sections;

The \*(C`sections\*(C' method returns all normal sections from the file, in the same order as in the file. This may not be the order they will be written to the test file, for that you should see the \*(C`sorted\*(C' method.

Returns a list of Test::Inline::Section objects, or the null array \*(C`()\*(C' if the file does not contain any non-setup sections.

sorted

The \*(C`sorted\*(C' method returns all normal sections from the file, in an order that satisfies any dependencies in the sections.

Returns a reference to an array of Test::Inline::Section objects, 0 if the file does not contain any non-setup sections, or \*(C`undef\*(C' on error.

tests

If the number of tests for all of the sections within the file are known, then the number of tests for the entire file can also be determined.

The \*(C`tests\*(C' method determines if the number of tests can be known, and if so, calculates and returns the number of tests. Returns false if the number of tests is not known.

merged_content

The \*(C`merged_content\*(C' method generates and returns the merged contents of all the sections in the file, including the setup sections at the beginning. The method does not return the entire file, merely the part contained in the sections. For the full file contents, see the \*(C`file_content\*(C' method.

Returns a string containing the merged section content on success, false if there is no content, despite the existance of sections ( which would have been empty ), or \*(C`undef\*(C' on error.

SUPPORT

See the main \s-1SUPPORT\s0 section.

AUTHOR

Adam Kennedy <[email protected]>, <http://ali.as/>

COPYRIGHT

Copyright 2004 - 2013 Adam Kennedy.

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

The full text of the license can be found in the \s-1LICENSE\s0 file included with this module.