(retracted by #14057)
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / Functions.t
CommitLineData
66c981cf 1#!perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6
7}
8
9use File::Basename;
10use File::Spec;
11
12use Test::More;
13plan tests => 9;
14
15
16use_ok( 'Pod::Functions' );
17
18# How do you test exported vars?
19my( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Kinds, \%Kinds );
20is( $pkg_ref, $exp_ref, '%Pod::Functions::Kinds exported' );
21
22( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Type, \%Type );
23is( $pkg_ref, $exp_ref, '%Pod::Functions::Type exported' );
24
25( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Flavor, \%Flavor );
26is( $pkg_ref, $exp_ref, '%Pod::Functions::Flavor exported' );
27
28( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Type_Description,
29 \%Type_Description );
30is( $pkg_ref, $exp_ref, '%Pod::Functions::Type_Description exported' );
31
32( $pkg_ref, $exp_ref ) = ( \@Pod::Functions::Type_Order, \@Type_Order );
33is( $pkg_ref, $exp_ref, '@Pod::Functions::Type_Order exported' );
34
35# Check @Type_Order
36my @catagories = qw(
37 String Regexp Math ARRAY LIST HASH I/O
38 Binary File Flow Namespace Misc Process Modules
39 Objects Socket SysV User Network Time
40);
41
42ok( eq_array( \@Type_Order, \@catagories ),
43 '@Type_Order' );
44
45my @cat_keys = grep exists $Type_Description{ $_ } => @Type_Order;
46
47ok( eq_array( \@cat_keys, \@catagories ),
48 'keys() %Type_Description' );
49
50my( undef, $path ) = fileparse( $0 );
51my $pod_functions = File::Spec->catfile(
52 $path, File::Spec->updir, 'Functions.pm' );
53
54SKIP: {
55 my $test_out = do { local $/; <DATA> };
56
57 skip( "Can't fork '$^X': $!", 1)
58 unless open my $fh, "$^X $pod_functions |";
59 my $fake_out = do { local $/; <$fh> };
60 while ( <$fh> ) { $fake_out .= $_ }
61 skip( "Pipe error: $!", 1)
62 unless close $fh;
63
64 is( $fake_out, $test_out, 'run as plain program' );
65}
66
67=head1 NAME
68
69Functions.t - Test Pod::Functions
70
71=head1 AUTHOR
72
7320011229 Abe Timmerman <abe@ztreet.demon.nl>
74
75=cut
76
77__DATA__
78
79Functions for SCALARs or strings:
80 chomp, chop, chr, crypt, hex, index, lc, lcfirst, length,
81 oct, ord, pack, q/STRING/, qq/STRING/, reverse, rindex,
82 sprintf, substr, tr///, uc, ucfirst, y///
83
84Regular expressions and pattern matching:
85 m//, pos, qr/PATTERN/, quotemeta, s///, split, study
86
87Numeric functions:
88 abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt,
89 srand
90
91Functions for real @ARRAYs:
92 pop, push, shift, splice, unshift
93
94Functions for list data:
95 grep, join, map, qw/STRING/, reverse, sort, unpack
96
97Functions for real %HASHes:
98 delete, each, exists, keys, values
99
100Input and output functions:
101 binmode, close, closedir, dbmclose, dbmopen, die, eof,
102 fileno, flock, format, getc, print, printf, read, readdir,
103 readline, rewinddir, seek, seekdir, select, syscall,
104 sysread, sysseek, syswrite, tell, telldir, truncate, warn,
105 write
106
107Functions for fixed length data or records:
108 pack, read, syscall, sysread, sysseek, syswrite, unpack,
109 vec
110
111Functions for filehandles, files, or directories:
112 -X, chdir, chmod, chown, chroot, fcntl, glob, ioctl, link,
113 lstat, mkdir, open, opendir, readlink, rename, rmdir,
114 stat, symlink, umask, unlink, utime
115
116Keywords related to control flow of your perl program:
117 caller, continue, die, do, dump, eval, exit, goto, last,
118 next, prototype, redo, return, sub, wantarray
119
120Keywords altering or affecting scoping of identifiers:
121 caller, import, local, my, our, package, use
122
123Miscellaneous functions:
124 defined, dump, eval, formline, local, my, our, prototype,
125 reset, scalar, undef, wantarray
126
127Functions for processes and process groups:
128 alarm, exec, fork, getpgrp, getppid, getpriority, kill,
129 pipe, qx/STRING/, setpgrp, setpriority, sleep, system,
130 times, wait, waitpid
131
132Keywords related to perl modules:
133 do, import, no, package, require, use
134
135Keywords related to classes and object-orientedness:
136 bless, dbmclose, dbmopen, package, ref, tie, untie, use
137
138Low-level socket functions:
139 accept, bind, connect, getpeername, getsockname,
140 getsockopt, listen, recv, send, setsockopt, shutdown,
141 socket, socketpair
142
143System V interprocess communication functions:
144 msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop,
145 shmctl, shmget, shmread, shmwrite
146
147Fetching user and group info:
148 endgrent, endhostent, endnetent, endpwent, getgrent,
149 getgrgid, getgrnam, getlogin, getpwent, getpwnam,
150 getpwuid, setgrent, setpwent
151
152Fetching network info:
153 endprotoent, endservent, gethostbyaddr, gethostbyname,
154 gethostent, getnetbyaddr, getnetbyname, getnetent,
155 getprotobyname, getprotobynumber, getprotoent,
156 getservbyname, getservbyport, getservent, sethostent,
157 setnetent, setprotoent, setservent
158
159Time-related functions:
160 gmtime, localtime, time, times