This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don’t write beyond the stack with scalar \()
[perl5.git] / t / porting / perlfunc.t
CommitLineData
4094982d
NC
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
7fa6cc82
NC
21# "Perl Functions by Category", and to have a one line summary for
22# Pod::Functions provided by a =for directive.
4094982d
NC
23
24BEGIN {
3a73a075 25 @INC = ('..', '../lib') if -f '../TestInit.pm';
4094982d
NC
26}
27
3a73a075 28use Config;
4094982d
NC
29use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
30
3a73a075
BF
31if ( $Config{usecrosscompile} ) {
32 print "1..0 # Not all files are available during cross-compilation\n";
33 exit 0;
34}
35
4094982d 36system "$^X ext/Pod-Functions/Functions_pm.PL --tap pod/perlfunc.pod";