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