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