1898184e3Ssthen#!perl -w 2898184e3Ssthen 3898184e3Ssthenuse strict; 4898184e3Ssthen 5898184e3Ssthenuse File::Basename; 6898184e3Ssthenuse File::Spec; 7898184e3Ssthen 8898184e3Ssthenuse Test::More; 9898184e3Ssthen 10898184e3SsthenBEGIN { 11898184e3Ssthen use_ok( 'Pod::Functions' ); 12898184e3Ssthen} 13898184e3Ssthen 14898184e3Ssthen# How do you test exported vars? 15898184e3Ssthenmy( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Kinds, \%Kinds ); 16898184e3Ssthenis( $pkg_ref, $exp_ref, '%Pod::Functions::Kinds exported' ); 17898184e3Ssthen 18898184e3Ssthen( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Type, \%Type ); 19898184e3Ssthenis( $pkg_ref, $exp_ref, '%Pod::Functions::Type exported' ); 20898184e3Ssthen 21898184e3Ssthen( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Flavor, \%Flavor ); 22898184e3Ssthenis( $pkg_ref, $exp_ref, '%Pod::Functions::Flavor exported' ); 23898184e3Ssthen 24898184e3Ssthen( $pkg_ref, $exp_ref ) = ( \%Pod::Functions::Type_Description, 25898184e3Ssthen \%Type_Description ); 26898184e3Ssthenis( $pkg_ref, $exp_ref, '%Pod::Functions::Type_Description exported' ); 27898184e3Ssthen 28898184e3Ssthen( $pkg_ref, $exp_ref ) = ( \@Pod::Functions::Type_Order, \@Type_Order ); 29898184e3Ssthenis( $pkg_ref, $exp_ref, '@Pod::Functions::Type_Order exported' ); 30898184e3Ssthen 31898184e3Ssthen# Check @Type_Order 32b8851fccSafresh1my @categories = qw( 33898184e3Ssthen String Regexp Math ARRAY LIST HASH I/O 34898184e3Ssthen Binary File Flow Namespace Misc Process 35898184e3Ssthen Modules Objects Socket SysV User Network Time 36898184e3Ssthen); 37898184e3Ssthen 38eac174f2Safresh1is_deeply( \@Type_Order, \@categories, 39898184e3Ssthen '@Type_Order' ); 40898184e3Ssthen 41898184e3Ssthenmy @cat_keys = grep exists $Type_Description{ $_ } => @Type_Order; 42898184e3Ssthen 43eac174f2Safresh1is_deeply( \@cat_keys, \@categories, 44898184e3Ssthen 'keys() %Type_Description' ); 45898184e3Ssthen 46898184e3SsthenSKIP: { 47898184e3Ssthen my $test_out = do { local $/; <DATA> }; 48898184e3Ssthen 49898184e3Ssthen skip( "Can't fork '$^X': $!", 1) 50898184e3Ssthen unless open my $fh, qq[$^X "-I../../lib" Functions.pm |]; 51898184e3Ssthen my $fake_out = do { local $/; <$fh> }; 52898184e3Ssthen skip( "Pipe error: $!", 1) 53898184e3Ssthen unless close $fh; 54898184e3Ssthen 55898184e3Ssthen is( $fake_out, $test_out, 'run as plain program' ); 56898184e3Ssthen} 57898184e3Ssthen 58898184e3Ssthenforeach my $func (sort keys %Flavor) { 59898184e3Ssthen my $desc = $Flavor{$func}; 60898184e3Ssthen like($desc, qr/^(?:[a-z]|SysV)/, 61898184e3Ssthen "Description for $desc starts with a lowercase letter or SysV"); 62898184e3Ssthen} 63898184e3Ssthen 64898184e3Ssthendone_testing(); 65898184e3Ssthen 66898184e3Ssthen=head1 NAME 67898184e3Ssthen 68898184e3SsthenFunctions.t - Test Pod::Functions 69898184e3Ssthen 70898184e3Ssthen=head1 AUTHOR 71898184e3Ssthen 72898184e3Ssthen20011229 Abe Timmerman <abe@ztreet.demon.nl> 73898184e3Ssthen 74898184e3Ssthen=cut 75898184e3Ssthen 76898184e3Ssthen__DATA__ 77898184e3Ssthen 78898184e3SsthenFunctions for SCALARs or strings: 79898184e3Ssthen chomp, chop, chr, crypt, fc, hex, index, lc, lcfirst, 80898184e3Ssthen length, oct, ord, pack, q/STRING/, qq/STRING/, reverse, 81898184e3Ssthen rindex, sprintf, substr, tr///, uc, ucfirst, y/// 82898184e3Ssthen 83898184e3SsthenRegular expressions and pattern matching: 84898184e3Ssthen m//, pos, qr/STRING/, quotemeta, s///, split, study 85898184e3Ssthen 86898184e3SsthenNumeric functions: 87898184e3Ssthen abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt, 88898184e3Ssthen srand 89898184e3Ssthen 90898184e3SsthenFunctions for real @ARRAYs: 91898184e3Ssthen each, keys, pop, push, shift, splice, unshift, values 92898184e3Ssthen 93898184e3SsthenFunctions for list data: 94898184e3Ssthen grep, join, map, qw/STRING/, reverse, sort, unpack 95898184e3Ssthen 96898184e3SsthenFunctions for real %HASHes: 97898184e3Ssthen delete, each, exists, keys, values 98898184e3Ssthen 99898184e3SsthenInput and output functions: 100898184e3Ssthen binmode, close, closedir, dbmclose, dbmopen, die, eof, 101898184e3Ssthen fileno, flock, format, getc, print, printf, read, readdir, 102898184e3Ssthen readline, rewinddir, say, seek, seekdir, select, syscall, 103898184e3Ssthen sysread, sysseek, syswrite, tell, telldir, truncate, warn, 104898184e3Ssthen write 105898184e3Ssthen 106898184e3SsthenFunctions for fixed-length data or records: 107898184e3Ssthen pack, read, syscall, sysread, sysseek, syswrite, unpack, 108898184e3Ssthen vec 109898184e3Ssthen 110898184e3SsthenFunctions for filehandles, files, or directories: 111898184e3Ssthen -X, chdir, chmod, chown, chroot, fcntl, glob, ioctl, link, 112898184e3Ssthen lstat, mkdir, open, opendir, readlink, rename, rmdir, 113b8851fccSafresh1 select, stat, symlink, sysopen, umask, unlink, utime 114898184e3Ssthen 115898184e3SsthenKeywords related to the control flow of your Perl program: 116898184e3Ssthen __FILE__, __LINE__, __PACKAGE__, __SUB__, break, caller, 117898184e3Ssthen continue, die, do, dump, eval, evalbytes, exit, goto, 118e0680481Safresh1 last, method, next, redo, return, sub, wantarray 119898184e3Ssthen 120898184e3SsthenKeywords related to scoping: 121e0680481Safresh1 caller, class, field, import, local, my, our, package, 122e0680481Safresh1 state, use 123898184e3Ssthen 124898184e3SsthenMiscellaneous functions: 125898184e3Ssthen defined, formline, lock, prototype, reset, scalar, undef 126898184e3Ssthen 127898184e3SsthenFunctions for processes and process groups: 128898184e3Ssthen alarm, exec, fork, getpgrp, getppid, getpriority, kill, 129898184e3Ssthen pipe, qx/STRING/, readpipe, setpgrp, setpriority, sleep, 130898184e3Ssthen system, times, wait, waitpid 131898184e3Ssthen 132898184e3SsthenKeywords related to Perl modules: 133898184e3Ssthen do, import, no, package, require, use 134898184e3Ssthen 135898184e3SsthenKeywords related to classes and object-orientation: 136*3d61058aSafresh1 __CLASS__, bless, class, dbmclose, dbmopen, field, method, 137*3d61058aSafresh1 package, ref, tie, tied, untie, use 138898184e3Ssthen 139898184e3SsthenLow-level socket functions: 140898184e3Ssthen accept, bind, connect, getpeername, getsockname, 141898184e3Ssthen getsockopt, listen, recv, send, setsockopt, shutdown, 142898184e3Ssthen socket, socketpair 143898184e3Ssthen 144898184e3SsthenSystem V interprocess communication functions: 145898184e3Ssthen msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop, 146898184e3Ssthen shmctl, shmget, shmread, shmwrite 147898184e3Ssthen 148898184e3SsthenFetching user and group info: 149898184e3Ssthen endgrent, endhostent, endnetent, endpwent, getgrent, 150898184e3Ssthen getgrgid, getgrnam, getlogin, getpwent, getpwnam, 151898184e3Ssthen getpwuid, setgrent, setpwent 152898184e3Ssthen 153898184e3SsthenFetching network info: 154898184e3Ssthen endprotoent, endservent, gethostbyaddr, gethostbyname, 155898184e3Ssthen gethostent, getnetbyaddr, getnetbyname, getnetent, 156898184e3Ssthen getprotobyname, getprotobynumber, getprotoent, 157898184e3Ssthen getservbyname, getservbyport, getservent, sethostent, 158898184e3Ssthen setnetent, setprotoent, setservent 159898184e3Ssthen 160898184e3SsthenTime-related functions: 161898184e3Ssthen gmtime, localtime, time, times 162