1Test::Pod::Content(3pm)User Contributed Perl DocumentatioTnest::Pod::Content(3pm)
2
3
4
6 Test::Pod::Content - Test a Pod's content
7
9 use Test::Pod::Content tests => 3;
10 pod_section_is 'Test::Pod::Content' , 'NAME', "Test::Pod::Content - Test a Pod's content", 'NAME section';
11 pod_section_like 'Test/Pod/Content.pm', 'SYNOPSIS', qr{ use \s Test::Pod::Content; }xm, 'SYNOPSIS section';
12 pod_section_like 'Test/Pod/Content.pm', 'DESCRIPTION', qr{ Test::Pod::Content \s provides \s the }xm, 'DESCRIPTION section';
13
15 This is a very simple module for testing a Pod's content. It is mainly
16 intended for testing the content of generated Pod - that is, the Pod
17 included in perl modules generated by some mechanism.
18
19 Another usage example is to test whether all files contain the same
20 copyright notice:
21
22 plan tests => scalar @filelist;
23
24 for my $file (sort @filelist) {
25 pod_section_like( $file, 'LICENSE AND COPYRIGHT', qr{
26 This \s library \s is \s free \s software\. \s
27 You \s may \s distribute/modify \s it \s under \s
28 the \s same \s terms \s as \s perl \s itself
29 }xms, "$file License notice");
30 }
31
32 See the files in the t/ directory for live examples.
33
34 Test::Pod::Content has a very simple concept of Pods: To
35 Test::Pod::Content, a Pod is separated into section. Each section
36 starts with a =head(1|2|3|4) directive, and ends with the next =head,
37 or with the end of the document (=cut).
38
39 This is a very drastic simplification of Pod's document object model,
40 and only allows for coarse-grained tests.
41
42 Test::Pod::Content provides the following subroutines for testing a
43 Pod's content:
44
46 pod_section_is
47 pod_section_is $file, $section, $content, $comment;
48
49 Tests whether a Pod section contains exactly the text given. Most
50 useful for testing the NAME section. You probably want to use
51 pod_section_like for all other sections.
52
53 $file may either be a filename (including path) or a module name.
54 Test::Pod::Content will search in @INC for the file/module given.
55
56 pod_section_like
57 pod_section_like $file, $section, qr{ use \s Test::Pod::Content\s }xm, $comment;
58
59 Tests whether the text in a Pod section matches the given regex. Be
60 sure to include the m / s regex qualifier if you expect your Pod
61 section to span multiple lines.
62
63 $file may either be a filename (including path) or a module name.
64 Test::Pod::Content will search in @INC for the file/module given.
65
67 • Performance
68
69 Every call to a pod_section_* method searches for the file in
70 question in @INC and parses it from its start. This means that
71 every test requires a Pod parser run, which is quite inefficient if
72 you conduct a big number of tests.
73
74 • Pod Syntax
75
76 Test::Pod::Coverage may report wrong test results if your pod is
77 not syntactically correct. You should use Test::Pod to check your
78 Pod's syntax.
79
81 Test::More
82
83 Pod::Simple
84
85 version
86
88 None known
89
91 Test::Pod for testing your POD's validity
92
93 Test::Pod::Coverage for checking wether your pod is complete
94
95 Pod::Tests, Test::Pod::Snippets and Pod::Snippets for extracting and
96 executing tests from a POD (If you plan doing so, here's a little
97 brain-train: Which of the tests in this module's "SYNOPSIS" section
98 would fail if you extracted and executed it?).
99
101 Copyright 2007 Martin Kutter.
102
103 This library is free software. You may distribute/modify it under the
104 same terms as perl itself
105
107 Martin Kutter <martin.kutter fen-net.de>
108
110 $Id: Content.pm 505 2008-06-22 09:54:54Z kutterma $
111 $Revision: 505 $
112 $Source: a $
113 $Date: 2008-06-22 11:54:54 +0200 (So, 22 Jun 2008) $
114 $HeadURL: http://svn.hyper-framework.org/Hyper/Test-Pod-Content/trunk/lib/Test/Pod/Content.pm $
115
116
117
118perl v5.38.0 2023-07-21 Test::Pod::Content(3pm)