1Test::Portability::FileUss(e3r)Contributed Perl DocumentTaetsito:n:Portability::Files(3)
2
3
4
6 Test::Portability::Files - Check file names portability
7
9 version 0.10
10
12 use Test::More;
13
14 plan skip_all => "Only for the module maintainer" unless $ENV{AUTHOR_TESTS};
15 plan skip_all => "Test::Portability::Files required for testing filenames portability"
16 unless eval "use Test::Portability::Files; 1";
17
18 options(all_tests => 1); # to be hyper-strict
19 run_tests();
20
22 This module is used to check the portability across operating systems
23 of the names of the files present in the distribution of a module. The
24 tests use the advices given in "Files and Filesystems" in perlport.
25 The author of a distribution can select which tests to execute.
26
27 To use this module, simply copy the code from the synopsis in a test
28 file named t/portfs.t for example, and add it to your MANIFEST. You
29 can delete the call to options() to enable only most common tests.
30
31 By default, not all tests are enabled because some are judged too
32 cumbersome to be practical, especially since some of the most limited
33 platforms (like MS-DOS) seem to be no longer supported. Here are the
34 default options:
35
36 • "use_file_find" is not enabled (check only the names as listed in
37 MANIFEST)
38
39 • "test_amiga_length" is not enabled
40
41 • "test_ansi_chars" is enabled
42
43 • "test_case" is enabled
44
45 • "test_dos_length" is not enabled
46
47 • "test_mac_length" is not enabled
48
49 • "test_one_dot" is enabled
50
51 • "test_space" is enabled
52
53 • "test_special_chars" is enabled
54
55 • "test_symlink" is enabled
56
57 • "test_vms_length" is enabled
58
59 • "test_windows_reserved" is enabled
60
61 To change any option, please see options().
62
64 The following functions are exported:
65
66 • options()
67
68 • run_tests()
69
71 options()
72 Set the module options, in particular, select which tests to
73 execute. Expects a hash.
74
75 General options
76
77 • "use_file_find" - set to 1 to check all the files in the
78 current hierarchy using "File::Find" instead of only checking
79 files listed in MANIFEST.
80
81 Tests
82
83 • "all_tests" - select all tests.
84
85 • "test_amiga_length" - check that the name fits within AmigaOS
86 name length limitations (107 characters).
87
88 • "test_ansi_chars" - check that the name only uses the portable
89 filename characters as defined by ANSI C and recommended by
90 perlport.
91
92 • "test_case" - check that the name of the file does not clash
93 with the name of another file on case-insensitive filesystems.
94
95 • "test_dir_noext" - check that the directory has no extension.
96
97 • "test_dos_length" - check that the name fits within DOS name
98 length limitations (8 characters max for the base name, 3
99 characters max for the extension).
100
101 • "test_mac_length" - check that the name fits within Mac OS
102 Classic name length limitations (31 characters).
103
104 • "test_one_dot" - check that the name only has one dot.
105
106 • "test_space" - check that the name has nos space.
107
108 • "test_special_chars" - check that the name does not use special
109 characters.
110
111 • "test_symlink" - check that the file is not a symbolic link.
112
113 • "test_vms_length" - check that the name fits within VMS name
114 length limitations (39 characters max for the base name, 39
115 characters max for the extension).
116
117 "test_windows_reserved" - check that the file name is not one
118 of the reserved Windows filenames that correspond to character
119 devices, such as con or com1.
120
121 Example
122
123 options(use_file_find => 1, all_tests => 1);
124
125 selects all tests and runs them against all files found using
126 "File::Find".
127
128 test_name_portability()
129 Test the portability of the given file name.
130
131 run_tests()
132 Execute the tests selected by options().
133
135 perlport
136
138 The development version is on github at
139 <https://https://github.com/abraxxa/Test-Portability-Files> and may be
140 cloned from
141 <git://https://github.com/abraxxa/Test-Portability-Files.git>
142
144 Please report any bugs or feature requests on the bugtracker website
145 <https://rt.cpan.org/Dist/Display.html?Queue=Test-Portability-Files> or
146 by email to bug-test-portability-files@rt.cpan.org <mailto:bug-test-
147 portability-files@rt.cpan.org>.
148
149 When submitting a bug or request, please include a test-file or a patch
150 to an existing test-file that illustrates the bug or desired feature.
151
153 • Sébastien Aperghis-Tramoni <sebastien@aperghis.net>
154
155 • Alexander Hartmaier <abraxxa@cpan.org>
156
158 • Graham Knop <haarg@haarg.org>
159
160 • Karen Etheridge <ether@cpan.org>
161
162 • Nathan Glenn <garfieldnate@gmail.com>
163
164 • Patrice Clement <monsieurp@gentoo.org>
165
166 • Robert Rothenberg <rrwo@cpan.org>
167
169 This software is copyright (c) 2019 by Sébastien Aperghis-Tramoni,
170 Alexander Hartmaier.
171
172 This is free software; you can redistribute it and/or modify it under
173 the same terms as the Perl 5 programming language system itself.
174
175
176
177perl v5.36.0 2023-01-20 Test::Portability::Files(3)