Commit | Line | Data |
---|---|---|
66c981cf AT |
1 | #!perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
66c981cf AT |
6 | } |
7 | ||
8 | use File::Basename; | |
9 | use File::Spec; | |
10 | ||
11 | use Test::More; | |
12 | plan tests => 9; | |
13 | ||
14 | ||
15 | use_ok( 'Pod::Functions' ); | |
16 | ||
17 | # How do you test exported vars? | |
18 | my( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Kinds, \%Kinds ); | |
19 | is( $pkg_ref, $exp_ref, '%Pod::Functions::Kinds exported' ); | |
20 | ||
21 | ( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Type, \%Type ); | |
22 | is( $pkg_ref, $exp_ref, '%Pod::Functions::Type exported' ); | |
23 | ||
24 | ( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Flavor, \%Flavor ); | |
25 | is( $pkg_ref, $exp_ref, '%Pod::Functions::Flavor exported' ); | |
26 | ||
27 | ( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Type_Description, | |
28 | \%Type_Description ); | |
29 | is( $pkg_ref, $exp_ref, '%Pod::Functions::Type_Description exported' ); | |
30 | ||
31 | ( $pkg_ref, $exp_ref ) = ( \@Pod::Functions::Type_Order, \@Type_Order ); | |
32 | is( $pkg_ref, $exp_ref, '@Pod::Functions::Type_Order exported' ); | |
33 | ||
34 | # Check @Type_Order | |
35 | my @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 | ||
41 | ok( eq_array( \@Type_Order, \@catagories ), | |
42 | '@Type_Order' ); | |
43 | ||
44 | my @cat_keys = grep exists $Type_Description{ $_ } => @Type_Order; | |
45 | ||
46 | ok( eq_array( \@cat_keys, \@catagories ), | |
47 | 'keys() %Type_Description' ); | |
48 | ||
49 | my( undef, $path ) = fileparse( $0 ); | |
50 | my $pod_functions = File::Spec->catfile( | |
51 | $path, File::Spec->updir, 'Functions.pm' ); | |
52 | ||
53 | SKIP: { | |
54 | my $test_out = do { local $/; <DATA> }; | |
55 | ||
56 | skip( "Can't fork '$^X': $!", 1) | |
6170a8f8 | 57 | unless open my $fh, qq[$^X "-I../lib" $pod_functions |]; |
66c981cf | 58 | my $fake_out = do { local $/; <$fh> }; |
66c981cf AT |
59 | skip( "Pipe error: $!", 1) |
60 | unless close $fh; | |
61 | ||
6170a8f8 | 62 | is( $fake_out, $test_out, 'run as plain program' ); |
66c981cf AT |
63 | } |
64 | ||
65 | =head1 NAME | |
66 | ||
67 | Functions.t - Test Pod::Functions | |
68 | ||
69 | =head1 AUTHOR | |
70 | ||
71 | 20011229 Abe Timmerman <abe@ztreet.demon.nl> | |
72 | ||
73 | =cut | |
74 | ||
75 | __DATA__ | |
76 | ||
77 | Functions 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 | ||
82 | Regular expressions and pattern matching: | |
fccfe6e8 | 83 | m//, pos, qr/STRING/, quotemeta, s///, split, study |
66c981cf AT |
84 | |
85 | Numeric functions: | |
86 | abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt, | |
87 | srand | |
88 | ||
89 | Functions for real @ARRAYs: | |
90 | pop, push, shift, splice, unshift | |
91 | ||
92 | Functions for list data: | |
93 | grep, join, map, qw/STRING/, reverse, sort, unpack | |
94 | ||
95 | Functions for real %HASHes: | |
96 | delete, each, exists, keys, values | |
97 | ||
98 | Input 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 | ||
105 | Functions for fixed length data or records: | |
106 | pack, read, syscall, sysread, sysseek, syswrite, unpack, | |
107 | vec | |
108 | ||
109 | Functions for filehandles, files, or directories: | |
110 | -X, chdir, chmod, chown, chroot, fcntl, glob, ioctl, link, | |
111 | lstat, mkdir, open, opendir, readlink, rename, rmdir, | |
fccfe6e8 | 112 | stat, symlink, sysopen, umask, unlink, utime |
66c981cf AT |
113 | |
114 | Keywords 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 | ||
118 | Keywords altering or affecting scoping of identifiers: | |
119 | caller, import, local, my, our, package, use | |
120 | ||
121 | Miscellaneous functions: | |
122 | defined, dump, eval, formline, local, my, our, prototype, | |
123 | reset, scalar, undef, wantarray | |
124 | ||
125 | Functions for processes and process groups: | |
126 | alarm, exec, fork, getpgrp, getppid, getpriority, kill, | |
fccfe6e8 A |
127 | pipe, qx/STRING/, readpipe, setpgrp, setpriority, sleep, |
128 | system, times, wait, waitpid | |
66c981cf AT |
129 | |
130 | Keywords related to perl modules: | |
131 | do, import, no, package, require, use | |
132 | ||
133 | Keywords related to classes and object-orientedness: | |
fccfe6e8 A |
134 | bless, dbmclose, dbmopen, package, ref, tie, tied, untie, |
135 | use | |
66c981cf AT |
136 | |
137 | Low-level socket functions: | |
138 | accept, bind, connect, getpeername, getsockname, | |
139 | getsockopt, listen, recv, send, setsockopt, shutdown, | |
140 | socket, socketpair | |
141 | ||
142 | System V interprocess communication functions: | |
143 | msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop, | |
144 | shmctl, shmget, shmread, shmwrite | |
145 | ||
146 | Fetching user and group info: | |
147 | endgrent, endhostent, endnetent, endpwent, getgrent, | |
148 | getgrgid, getgrnam, getlogin, getpwent, getpwnam, | |
149 | getpwuid, setgrent, setpwent | |
150 | ||
151 | Fetching 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 | ||
158 | Time-related functions: | |
159 | gmtime, localtime, time, times |