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 version 2.214
10
12 This class is where the heavy lifting happens to actually generating a
13 test file takes place. Given a source filename, this modules will load
14 it, parse out the relavent bits, put them into order based on the tags,
15 and then merge them into a test file.
16
18 new
19 my $File = Test::Inline::Script->new( $class, \@sections, $check_count );
20
21 The "new" constructor takes a class name, set of Section objects and an
22 optional "check_count" flag.
23
24 Returns a Test::Inline::Script object on success. Returns "undef" on
25 error.
26
27 class
28 Returns the class that the test file will test
29
30 filename
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 my $config = $File->config;
39
40 The "config" method returns the config object for the file, assuming
41 that it has one. If more than one are found, the first will be used,
42 and any additional config sections discarded.
43
44 Returns a Test::Inline::Config object on success, or false if the file
45 does not contain a config section.
46
47 setup
48 my @setup = $File->setup;
49
50 The "setup" method returns the setup sections from the file, in the
51 same order as in the file.
52
53 Returns a list of setup Test::Inline::Section objects, the null array
54 "()" if the file does not contain any setup objects.
55
56 sections
57 my @sections = $File->sections;
58
59 The "sections" method returns all normal sections from the file, in the
60 same order as in the file. This may not be the order they will be
61 written to the test file, for that you should see the "sorted" method.
62
63 Returns a list of Test::Inline::Section objects, or the null array "()"
64 if the file does not contain any non-setup sections.
65
66 sorted
67 The "sorted" method returns all normal sections from the file, in an
68 order that satisfies any dependencies in the sections.
69
70 Returns a reference to an array of Test::Inline::Section objects, 0 if
71 the file does not contain any non-setup sections, or "undef" on error.
72
73 tests
74 If the number of tests for all of the sections within the file are
75 known, then the number of tests for the entire file can also be
76 determined.
77
78 The "tests" method determines if the number of tests can be known, and
79 if so, calculates and returns the number of tests. Returns false if the
80 number of tests is not known.
81
82 merged_content
83 The "merged_content" method generates and returns the merged contents
84 of all the sections in the file, including the setup sections at the
85 beginning. The method does not return the entire file, merely the part
86 contained in the sections. For the full file contents, see the
87 "file_content" method.
88
89 Returns a string containing the merged section content on success,
90 false if there is no content, despite the existance of sections ( which
91 would have been empty ), or "undef" on error.
92
94 See the main SUPPORT section.
95
96 Bugs may be submitted through the RT bug tracker
97 <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Inline> (or
98 bug-Test-Inline@rt.cpan.org <mailto:bug-Test-Inline@rt.cpan.org>).
99
101 Adam Kennedy <adamk@cpan.org>
102
104 This software is copyright (c) 2003 by Adam Kennedy.
105
106 This is free software; you can redistribute it and/or modify it under
107 the same terms as the Perl 5 programming language system itself.
108
109
110
111perl v5.38.0 2023-07-21 Test::Inline::Script(3)