Check file names portability
version 0.06
use Test::More; plan skip_all => "Only for the module maintainer" unless $ENV{AUTHOR_TESTS}; plan skip_all => "Test::Portability::Files required for testing filenames portability" unless eval "use Test::Portability::Files; 1"; options(all_tests => 1); # to be hyper-strict run_tests();
This module is used to check the portability across operating systems of the names of the files present in the distribution of a module. The tests use the advices given in \*(L"Files and Filesystems\*(R" in perlport. The author of a distribution can select which tests to execute.
To use this module, simply copy the code from the synopsis in a test file named t/portfs.t for example, and add it to your \s-1MANIFEST\s0. You can delete the call to \*(C`options()\*(C' to enable only most common tests.
By default, not all tests are enabled because some are judged too cumbersome to be practical, especially since some of the most limited platforms (like MS-DOS) seem to be no longer supported. Here are the default options:
\*(C`use_file_find\*(C' is not enabled (check only the names as listed in \s-1MANIFEST\s0)
\*(C`test_amiga_length\*(C' is not enabled
\*(C`test_ansi_chars\*(C' is enabled
\*(C`test_case\*(C' is enabled
\*(C`test_dos_length\*(C' is not enabled
\*(C`test_mac_length\*(C' is not enabled
\*(C`test_one_dot\*(C' is enabled
\*(C`test_space\*(C' is enabled
\*(C`test_special_chars\*(C' is enabled
\*(C`test_symlink\*(C' is enabled
\*(C`test_vms_length\*(C' is enabled
To change any option, please see \*(C`options()\*(C'.
The following functions are exported:
\*(C`options()\*(C'
\*(C`run_tests()\*(C'
Set the module options, in particular, select which tests to execute. Expects a hash. General options
\*(C`use_file_find\*(C' - set to 1 to check all the files in the current hierarchy using \*(C`File::Find\*(C' instead of only checking files listed in \s-1MANIFEST\s0.
Tests
\*(C`all_tests\*(C' - select all tests.
\*(C`test_amiga_length\*(C' - check that the name fits within AmigaOS name length limitations (107 characters).
\*(C`test_ansi_chars\*(C' - check that the name only uses the portable filename characters as defined by \s-1ANSI\s0 C and recommended by perlport.
\*(C`test_case\*(C' - check that the name of the file does not clash with the name of another file on case-insensitive filesystems.
\*(C`test_dir_noext\*(C' - check that the directory has no extension.
\*(C`test_dos_length\*(C' - check that the name fits within \s-1DOS\s0 name length limitations (8 characters max for the base name, 3 characters max for the extension).
\*(C`test_mac_length\*(C' - check that the name fits within Mac \s-1OS\s0 Classic name length limitations (31 characters).
\*(C`test_one_dot\*(C' - check that the name only has one dot.
\*(C`test_space\*(C' - check that the name has nos space.
\*(C`test_special_chars\*(C' - check that the name does not use special characters.
\*(C`test_symlink\*(C' - check that the file is not a symbolic link.
\*(C`test_vms_length\*(C' - check that the name fits within \s-1VMS\s0 name length limitations (39 characters max for the base name, 39 characters max for the extension).
Example options(use_file_find => 1, all_tests => 1); selects all tests and runs them against all files found using \*(C`File::Find\*(C'.
Test the portability of the given file name. Execute the tests selected by \*(C`options()\*(C'.
perlport
Please report any bugs or feature requests to \*(C`[email protected]\*(C', or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Se\*'bastien Aperghis-Tramoni <[email protected]>
Alexander Hartmaier <[email protected]>
This software is copyright (c) 2012 by Se\*'bastien Aperghis-Tramoni, Alexander Hartmaier.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.