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

NAME

6       Test::TrailingSpace
7

VERSION

9       version 0.0302
10

SYNOPSIS

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

DESCRIPTION

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

NAME

63       Test::TrailingSpace - test for trailing space in source files.
64

METHODS

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

AUTHOR

97       Shlomi Fish, <http://www.shlomifish.org/> .
98

SEE ALSO

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

AUTHOR

130       Shlomi Fish <shlomif@cpan.org>
131
133       This software is Copyright (c) 2012 by Shlomi Fish.
134
135       This is free software, licensed under:
136
137         The MIT (X11) License
138
139
140
141perl v5.30.0                      2019-08-26            Test::TrailingSpace(3)
Impressum