xref: /openbsd/gnu/usr.bin/perl/t/porting/perlfunc.t (revision e5dd7070)
1#!./perl -w
2
3# What does this test?
4# This checks that changes to pod/perlfunc.pod don't accidentally break the
5# build by causing ext/Pod-Functions/Functions_pm.PL to abort.
6#
7# Why do we test this?
8# Pod::Functions is generated from pod/perlfunc.pod by
9# ext/Pod-Functions/Functions_pm.PL
10# If it can't parse pod/perlfunc.pod, it will abort, which will cause the
11# build to break. It's really not possible for it to carry on, hence aborting
12# is the only option. However, innocent-seeming changes to documentation
13# shouldn't break the build, and we expect everyone to run (at least)
14# the porting tests, hence this test, to catch such problems before it's too
15# late. To avoid duplicating the parsing logic, we make Functions_pm.PL take
16# a --tap option, to test that all is well.
17#
18# It's broken - how do I fix it?
19# Likely it's because you changed something in pod/perlfunc.pod
20# If you added a new function, it needs to be added to one or more groups in
21# "Perl Functions by Category", and to have a one line summary for
22# Pod::Functions provided by a =for directive.
23
24BEGIN {
25    @INC = ('..', '../lib') if -f '../TestInit.pm';
26}
27
28use Config;
29use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
30
31if ( $Config{usecrosscompile} ) {
32    print "1..0 # Not all files are available during cross-compilation\n";
33    exit 0;
34}
35
36if ( ord("A") == 193) {
37    print "1..0 # EBCDIC sorts differenly than expected\n";
38    exit 0;
39}
40
41system "$^X ext/Pod-Functions/Functions_pm.PL --tap pod/perlfunc.pod";
42