1Test::TrailingSpace(3)User Contributed Perl DocumentationTest::TrailingSpace(3)
2
3
4

NAME

6       Test::TrailingSpace - test for trailing space in source files.
7

SYNOPSIS

9           use Test::TrailingSpace;
10
11           my $finder = Test::TrailingSpace->new(
12               {
13                   root => '.',
14                   filename_regex => qr/\.(?:t|pm|pl)\z/,
15               },
16           );
17
18           # TEST
19           $finder->no_trailing_space(
20               "No trailing space was found."
21           );
22
23       Or, if you want the test to be optional:
24
25           use Test::More;
26
27           eval "use Test::TrailingSpace";
28           if ($@)
29           {
30               plan skip_all => "Test::TrailingSpace required for trailing space test.";
31           }
32           else
33           {
34               plan tests => 1;
35           }
36
37           my $finder = Test::TrailingSpace->new(
38               {
39                   root => '.',
40                   filename_regex => qr/\.(?:t|pm|pl)\z/,
41               },
42           );
43
44           # TEST
45           $finder->no_trailing_space(
46               "No trailing space was found."
47           );
48

DESCRIPTION

50       This module is used to test for lack of trailing space. See the
51       synopsis for more details.
52
53       NOTE: there is an older CPAN distribution titled Test::EOL that also
54       supports testing for trailing space / trailing whitespace, although it
55       has some limitations that Test::TrailingSpace does not have, and also
56       only calls it "trailing whitespace", rather than "trailing space".
57       Whenever possible, one should prefer to use it, instead of this module.
58

METHODS

60   new({ root => ".", filename_regex => qr/\. ... \z/,})
61       Constructs a new object with the root (that defaults to "." and the
62       filename matching regular expression. All the files under root matching
63       the pattern will be searched (excpet for those under version control
64       directories, "blib", "_build", etc.).
65
66       The 'abs_path_prune_re' parameter can be used to specify a regular
67       expression to prune the absolute path based on, so as to ignore what is
68       under there.
69
70       So
71
72           my $finder = Test::TrailingSpace->new(
73               {
74                   root => '.',
75                   filename_regex => qr/\.(?:t|pm|pl)\z/,
76                   abs_path_prune_re => qr#\Alib/sample-data#,
77               }
78           );
79
80       Will ignore everything under "lib/sample-data" . Note that as of
81       Test::TrailingSpace version 0.0300 it can also be used to skip files
82       with these filenames (e.g: "abs_path_prune_re => qr#\.patch\z#").
83
84   $finder->no_trailing_space($blurb)
85       Determines if there is no trailing space in the source files. Returns
86       true if no trailing space was found, and false if trailing space was
87       found.  It is equivalent to Test::More::ok(), with diagnostics to
88       report if there is trailing space.
89

AUTHOR

91       Shlomi Fish, <http://www.shlomifish.org/> .
92

SEE ALSO

94       ยท   Test::EOL
95
96           Test::EOL
97
99       Copyright 2012 Shlomi Fish.
100
101       This program is distributed under the MIT (X11) License:
102       <http://www.opensource.org/licenses/mit-license.php>
103
104       Permission is hereby granted, free of charge, to any person obtaining a
105       copy of this software and associated documentation files (the
106       "Software"), to deal in the Software without restriction, including
107       without limitation the rights to use, copy, modify, merge, publish,
108       distribute, sublicense, and/or sell copies of the Software, and to
109       permit persons to whom the Software is furnished to do so, subject to
110       the following conditions:
111
112       The above copyright notice and this permission notice shall be included
113       in all copies or substantial portions of the Software.
114
115       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
116       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
117       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
118       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
119       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
120       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
121       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
122
123
124
125perl v5.28.1                      2019-02-02            Test::TrailingSpace(3)
Impressum