epic-s6ts
[kivitendo-erp.git] / t / 011pod.t
1 # -*- Mode: perl; indent-tabs-mode: nil -*-
2
3 # The contents of this file are subject to the Mozilla Public
4 # License Version 1.1 (the "License"); you may not use this file
5 # except in compliance with the License. You may obtain a copy of
6 # the License at http://www.mozilla.org/MPL/
7
8 # Software distributed under the License is distributed on an "AS
9 # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 # implied. See the License for the specific language governing
11 # rights and limitations under the License.
12
13 # The Original Code are the Bugzilla Tests.
14
15 # Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
16
17
18 ##################
19 #Bugzilla Test 11#
20 ##POD validation##
21
22 use strict;
23
24 use lib 't';
25
26 use Support::Files;
27 use Pod::Checker;
28
29 use Test::More tests => scalar(@Support::Files::testitems);
30
31 # Capture the TESTOUT from Test::More or Test::Builder for printing errors.
32 # This will handle verbosity for us automatically.
33 my $fh;
34 {
35     local $^W = 0;  # Don't complain about non-existent filehandles
36     if (-e \*Test::More::TESTOUT) {
37         $fh = \*Test::More::TESTOUT;
38     } elsif (-e \*Test::Builder::TESTOUT) {
39         $fh = \*Test::Builder::TESTOUT;
40     } else {
41         $fh = \*STDOUT;
42     }
43 }
44
45 my @testitems = @Support::Files::testitems;
46
47 foreach my $file (@testitems) {
48     $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
49     next if (!$file); # skip null entries
50     my $error_count = podchecker($file, $fh);
51     if ($error_count < 0) {
52         ok(1,"$file does not contain any POD");
53     } elsif ($error_count == 0) {
54         ok(1,"$file has correct POD syntax");
55     } else {
56         ok(0,"$file has incorrect POD syntax --ERROR");
57     }
58 }
59
60 exit 0;