Commit | Line | Data |
a83ae797 |
1 | NAME |
2 | Test::EOL - Check the correct line endings in your project |
3 | |
4 | SYNOPSIS |
5bcec1c9 |
5 | "Test::EOL" lets you check the presence of windows line endings in your |
6 | perl code. It report its results in standard "Test::Simple" fashion: |
a83ae797 |
7 | |
8 | use Test::EOL tests => 1; |
5bcec1c9 |
9 | eol_unix_ok( 'lib/Module.pm', 'Module is ^M free'); |
a83ae797 |
10 | |
91613276 |
11 | and to add checks for trailing whitespace: |
12 | |
13 | use Test::EOL tests => 1; |
14 | eol_unix_ok( 'lib/Module.pm', 'Module is ^M and trailing whitespace free', { trailing_whitespace => 1 }); |
15 | |
a83ae797 |
16 | Module authors can include the following in a t/eol.t and have |
17 | "Test::EOL" automatically find and check all perl files in a module |
18 | distribution: |
19 | |
20 | use Test::EOL; |
21 | all_perl_files_ok(); |
22 | |
23 | or |
24 | |
25 | use Test::EOL; |
26 | all_perl_files_ok( @mydirs ); |
27 | |
91613276 |
28 | and if authors would like to check for trailing whitespace: |
29 | |
30 | use Test::EOL; |
31 | all_perl_files_ok({ trailing_whitespace => 1 }); |
32 | |
33 | or |
34 | |
35 | use Test::EOL; |
36 | all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs ); |
37 | |
a83ae797 |
38 | DESCRIPTION |
39 | This module scans your project/distribution for any perl files (scripts, |
5bcec1c9 |
40 | modules, etc) for the presence of windows line endings. |
a83ae797 |
41 | |
42 | EXPORT |
43 | A list of functions that can be exported. You can delete this section if |
44 | you don't export anything, such as for a purely object-oriented module. |
45 | |
46 | FUNCTIONS |
91613276 |
47 | all_perl_files_ok( [ \%options ], [ @directories ] ) |
a83ae797 |
48 | Applies "eol_unix_ok()" to all perl files found in @directories (and sub |
49 | directories). If no <@directories> is given, the starting point is one |
50 | level above the current running script, that should cover all the files |
51 | of a typical CPAN distribution. A perl file is *.pl or *.pm or *.t or a |
52 | file starting with "#!...perl" |
53 | |
54 | If the test plan is defined: |
55 | |
56 | use Test::EOL tests => 3; |
57 | all_perl_files_ok(); |
58 | |
59 | the total number of files tested must be specified. |
60 | |
91613276 |
61 | eol_unix_ok( $file [, $text] [, \%options ] ) |
a83ae797 |
62 | Run a unix EOL check on $file. For a module, the path (lib/My/Module.pm) |
63 | or the name (My::Module) can be both used. |
64 | |
65 | AUTHOR |
66 | Tomas Doran (t0m) "<bobtfish@bobtfish.net>" |
67 | |
68 | BUGS |
69 | Testing for EOL styles other than unix (\n) currently unsupported. |
70 | |
71 | The source code can be found on github, as listed in " META.yml ", |
72 | patches are welcome. |
73 | |
74 | Otherwise please report any bugs or feature requests to "bug-test-eol at |
75 | rt.cpan.org", or through the web interface at |
76 | <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-EOL>. I will be |
77 | notified, and then you'll automatically be notified of progress on your |
78 | bug as I make changes. |
79 | |
80 | ACKNOWLEDGEMENTS |
81 | Shamelessly ripped off from Test::NoTabs. |
82 | |
83 | SEE ALSO |
84 | Test::More, Test::Pod. Test::Distribution, <Test:NoWarnings>, |
85 | Test::NoTabs, Module::Install::AuthorTests. |
86 | |
87 | COPYRIGHT & LICENSE |
88 | Copyright 2009 Tomas Doran, some rights reserved. |
89 | |
90 | This program is free software; you can redistribute it and/or modify it |
91 | under the same terms as Perl itself. |
92 | |