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
17 my $File = Test::Inline::Script->new( $class, \@sections, $check_count );
18
19 The "new" constructor takes a class name, set of Section objects and an
20 optional "check_count" flag.
21
22 Returns a Test::Inline::Script object on success. Returns "undef" on
23 error.
24
25 class
26
27 Returns the class that the test file will test
28
29 filename
30
31 my $filename = $File->filename;
32
33 The "filename" method returns the name of the output file that the
34 tests should be written to. For example, the class "Foo::Bar" would
35 have the filename value "foo_bar.t".
36
37 config
38
39 my $config = $File->config;
40
41 The "config" method returns the config object for the file, assuming
42 that it has one. If more than one are found, the first will be used,
43 and any additional config sections discarded.
44
45 Returns a Test::Inline::Config object on success, or false if the file
46 does not contain a config section.
47
48 setup
49
50 my @setup = $File->setup;
51
52 The "setup" method returns the setup sections from the file, in the
53 same order as in the file.
54
55 Returns a list of setup Test::Inline::Section objects, the null array
56 "()" if the file does not contain any setup objects.
57
58 sections
59
60 my @sections = $File->sections;
61
62 The "sections" method returns all normal sections from the file, in the
63 same order as in the file. This may not be the order they will be writ‐
64 ten to the test file, for that you should see the "sorted" method.
65
66 Returns a list of Test::Inline::Section objects, or the null array "()"
67 if the file does not contain any non-setup sections.
68
69 sorted
70
71 The "sorted" method returns all normal sections from the file, in an
72 order that satisfies any dependencies in the sections.
73
74 Returns a reference to an array of Test::Inline::Section objects, 0 if
75 the file does not contain any non-setup sections, or "undef" on error.
76
77 tests
78
79 If the number of tests for all of the sections within the file are
80 known, then the number of tests for the entire file can also be deter‐
81 mined.
82
83 The "tests" method determines if the number of tests can be known, and
84 if so, calculates and returns the number of tests. Returns false if the
85 number of tests is not known.
86
87 merged_content
88
89 The "merged_content" method generates and returns the merged contents
90 of all the sections in the file, including the setup sections at the
91 beginning. The method does not return the entire file, merely the part
92 contained in the sections. For the full file contents, see the
93 "file_content" method.
94
95 Returns a string containing the merged section content on success,
96 false if there is no content, despite the existance of sections ( which
97 would have been empty ), or "undef" on error.
98
100 See the main SUPPORT section.
101
103 Adam Kennedy <adamk@cpan.org>, <http://ali.as/>
104
106 Copyright 2004 - 2007 Adam Kennedy.
107
108 This program is free software; you can redistribute it and/or modify it
109 under the same terms as Perl itself.
110
111 The full text of the license can be found in the LICENSE file included
112 with this module.
113
114
115
116perl v5.8.8 2007-08-17 Test::Inline::Script(3)