1Test::Inline::Script(3)User Contributed Perl DocumentatioTnest::Inline::Script(3)
2
3
4
6 Test::Inline::Script - Generate the test file for a single source file
7
9 This class is where the heavy lifting happens to actually generating a
10 test file takes place. Given a source filename, this modules will load
11 it, parse out the relavent bits, put them into order based on the tags,
12 and then merge them into a test file.
13
15 new
16 my $File = Test::Inline::Script->new( $class, \@sections, $check_count );
17
18 The "new" constructor takes a class name, set of Section objects and an
19 optional "check_count" flag.
20
21 Returns a Test::Inline::Script object on success. Returns "undef" on
22 error.
23
24 class
25 Returns the class that the test file will test
26
27 filename
28 my $filename = $File->filename;
29
30 The "filename" method returns the name of the output file that the
31 tests should be written to. For example, the class "Foo::Bar" would
32 have the filename value "foo_bar.t".
33
34 config
35 my $config = $File->config;
36
37 The "config" method returns the config object for the file, assuming
38 that it has one. If more than one are found, the first will be used,
39 and any additional config sections discarded.
40
41 Returns a Test::Inline::Config object on success, or false if the file
42 does not contain a config section.
43
44 setup
45 my @setup = $File->setup;
46
47 The "setup" method returns the setup sections from the file, in the
48 same order as in the file.
49
50 Returns a list of setup Test::Inline::Section objects, the null array
51 "()" if the file does not contain any setup objects.
52
53 sections
54 my @sections = $File->sections;
55
56 The "sections" method returns all normal sections from the file, in the
57 same order as in the file. This may not be the order they will be
58 written to the test file, for that you should see the "sorted" method.
59
60 Returns a list of Test::Inline::Section objects, or the null array "()"
61 if the file does not contain any non-setup sections.
62
63 sorted
64 The "sorted" method returns all normal sections from the file, in an
65 order that satisfies any dependencies in the sections.
66
67 Returns a reference to an array of Test::Inline::Section objects, 0 if
68 the file does not contain any non-setup sections, or "undef" on error.
69
70 tests
71 If the number of tests for all of the sections within the file are
72 known, then the number of tests for the entire file can also be
73 determined.
74
75 The "tests" method determines if the number of tests can be known, and
76 if so, calculates and returns the number of tests. Returns false if the
77 number of tests is not known.
78
79 merged_content
80 The "merged_content" method generates and returns the merged contents
81 of all the sections in the file, including the setup sections at the
82 beginning. The method does not return the entire file, merely the part
83 contained in the sections. For the full file contents, see the
84 "file_content" method.
85
86 Returns a string containing the merged section content on success,
87 false if there is no content, despite the existance of sections ( which
88 would have been empty ), or "undef" on error.
89
91 See the main SUPPORT section.
92
94 Adam Kennedy <adamk@cpan.org>, <http://ali.as/>
95
97 Copyright 2004 - 2013 Adam Kennedy.
98
99 This program is free software; you can redistribute it and/or modify it
100 under the same terms as Perl itself.
101
102 The full text of the license can be found in the LICENSE file included
103 with this module.
104
105
106
107perl v5.28.1 2013-04-09 Test::Inline::Script(3)