1Test::EOL(3) User Contributed Perl Documentation Test::EOL(3)
2
3
4
6 Test::EOL - Check the correct line endings in your project
7
9 version 2.02
10
12 "Test::EOL" lets you check for the presence of trailing whitespace
13 and/or windows line endings in your perl code. It reports its results
14 in standard "Test::Simple" fashion:
15
16 use Test::EOL tests => 1;
17 eol_unix_ok( 'lib/Module.pm', 'Module is ^M free');
18
19 and to add checks for trailing whitespace:
20
21 use Test::EOL tests => 1;
22 eol_unix_ok( 'lib/Module.pm', 'Module is ^M and trailing whitespace free', { trailing_whitespace => 1 });
23
24 Module authors can include the following in a t/eol.t and have
25 "Test::EOL" automatically find and check all perl files in a module
26 distribution:
27
28 use Test::EOL;
29 all_perl_files_ok();
30
31 or
32
33 use Test::EOL;
34 all_perl_files_ok( @mydirs );
35
36 and if authors would like to check for trailing whitespace:
37
38 use Test::EOL;
39 all_perl_files_ok({ trailing_whitespace => 1 });
40
41 or
42
43 use Test::EOL;
44 all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs );
45
46 or
47
48 use Test::More;
49 use Test::EOL 'no_test';
50 all_perl_files_ok();
51 done_testing;
52
54 This module scans your project/distribution for any perl files
55 (scripts, modules, etc) for the presence of windows line endings.
56
58 all_perl_files_ok
59 all_perl_files_ok( [ \%options ], [ @directories ] )
60
61 Applies eol_unix_ok() to all perl files found in @directories (and sub
62 directories). If no <@directories> is given, the starting point is the
63 current working directory, as tests are usually run from the top
64 directory in a typical CPAN distribution. A perl file is *.pl or *.pm
65 or *.pod or *.t or a file starting with "#!...perl"
66
67 Valid "\%options" currently are:
68
69 • trailing_whitespace
70
71 By default Test::EOL only looks for Windows (CR/LF) line-endings.
72 Set this to true to raise errors if any kind of trailing whitespace
73 is present in the file.
74
75 • all_reasons
76
77 Normally Test::EOL reports only the first error in every file
78 (given that a text file originated on Windows will fail every
79 single line). Set this a true value to register a test failure for
80 every line with an error.
81
82 If the test plan is defined:
83
84 use Test::EOL tests => 3;
85 all_perl_files_ok();
86
87 the total number of files tested must be specified.
88
89 eol_unix_ok
90 eol_unix_ok ( $file [, $text] [, \%options ] )
91
92 Run a unix EOL check on $file. For a module, the path
93 (lib/My/Module.pm) or the name (My::Module) can be both used. $text is
94 the diagnostic label emitted after the "ok"/"not ok" TAP output.
95 "\%options" takes the same values as described in "all_perl_files_ok".
96
98 A list of functions that can be exported. You can delete this section
99 if you don't export anything, such as for a purely object-oriented
100 module.
101
103 Shamelessly ripped off from Test::NoTabs.
104
106 • Test::More
107
108 • Test::Pod
109
110 • Test::Distribution
111
112 • <Test:NoWarnings>
113
114 • Test::NoTabs
115
116 • Module::Install::AuthorTests
117
119 Bugs may be submitted through the RT bug tracker
120 <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-EOL> (or
121 bug-Test-EOL@rt.cpan.org <mailto:bug-Test-EOL@rt.cpan.org>).
122
123 There is also a mailing list available for users of this distribution,
124 at <http://lists.perl.org/list/perl-qa.html>.
125
126 There is also an irc channel available for users of this distribution,
127 at "#perl" on "irc.perl.org" <irc://irc.perl.org/#perl-qa>.
128
130 Tomas Doran (t0m) <bobtfish@bobtfish.net>
131
133 • Karen Etheridge <ether@cpan.org>
134
135 • Olivier Mengué <dolmen@cpan.org>
136
137 • Peter Rabbitson <ribasushi@cpan.org>
138
139 • Florian Ragwitz <rafl@debian.org>
140
141 • Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
142
143 • Arthur Axel 'fREW' Schmidt <frioux@gmail.com>
144
145 • Father Chrysostomos <sprout@cpan.org>
146
147 • Kent Fredric <kentfredric@gmail.com>
148
150 This software is copyright (c) 2009 by Tomas Doran.
151
152 This is free software; you can redistribute it and/or modify it under
153 the same terms as the Perl 5 programming language system itself.
154
155
156
157perl v5.36.0 2023-01-20 Test::EOL(3)