This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Actually implement @EXPORT_OK of strptime correctly; delete'ing an undef element...
[perl5.git] / ext / POSIX / t / export.t
CommitLineData
57159ffe
NC
1#!./perl -w
2
3use strict;
4use Test::More;
5use Config;
6
7plan(skip_all => "POSIX is unavailable")
8 unless $Config{extensions} =~ /\bPOSIX\b/;
9
10require POSIX;
11POSIX->import();
12
13# @POSIX::EXPORT and @POSIX::EXPORT_OK are generated. The intent of this test is
14# to catch *unintended* changes to them introduced by bugs in refactoring.
15
16my %expect = (
17 EXPORT => [qw(%SIGRT ARG_MAX B0 B110 B1200 B134 B150 B1800 B19200 B200
18 B2400 B300 B38400 B4800 B50 B600 B75 B9600 BRKINT BUFSIZ
19 CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX CLK_TCK CLOCAL
20 CLOCKS_PER_SEC CREAD CS5 CS6 CS7 CS8 CSIZE CSTOPB DBL_DIG
21 DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP
22 DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP E2BIG EACCES EADDRINUSE
23 EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF EBUSY ECHILD
24 ECHO ECHOE ECHOK ECHONL ECONNABORTED ECONNREFUSED ECONNRESET
25 EDEADLK EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG
26 EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR EINVAL EIO EISCONN
27 EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENETDOWN
28 ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC
29 ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN
30 ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOF EOPNOTSUPP EPERM
31 EPFNOSUPPORT EPIPE EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE
32 EREMOTE ERESTART EROFS ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH
33 ESTALE ETIMEDOUT ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK
34 EXDEV EXIT_FAILURE EXIT_SUCCESS FD_CLOEXEC FILENAME_MAX
35 FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP
36 FLT_MAX_EXP FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX
37 FLT_ROUNDS F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK
38 F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK HUGE_VAL
39 HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR INLCR INPCK
40 INT_MAX INT_MIN ISIG ISTRIP IXOFF IXON LC_ALL LC_COLLATE
41 LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LDBL_DIG
42 LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP
43 LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP LINK_MAX
44 LONG_MAX LONG_MIN L_ctermid L_cuserid L_tmpname MAX_CANON
45 MAX_INPUT MB_CUR_MAX MB_LEN_MAX NAME_MAX NCCS NDEBUG
46 NGROUPS_MAX NOFLSH NULL OPEN_MAX OPOST O_ACCMODE O_APPEND
47 O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
48 O_WRONLY PARENB PARMRK PARODD PATH_MAX PIPE_BUF RAND_MAX R_OK
49 SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND
50 SA_RESTART SA_SIGINFO SCHAR_MAX SCHAR_MIN SEEK_CUR SEEK_END
51 SEEK_SET SHRT_MAX SHRT_MIN SIGABRT SIGALRM SIGBUS SIGCHLD
52 SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGPOLL
53 SIGPROF SIGQUIT SIGRTMAX SIGRTMIN SIGSEGV SIGSTOP SIGSYS
54 SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1
55 SIGUSR2 SIGVTALRM SIGXCPU SIGXFSZ SIG_BLOCK SIG_DFL SIG_ERR
56 SIG_IGN SIG_SETMASK SIG_UNBLOCK SSIZE_MAX STDERR_FILENO
57 STDIN_FILENO STDOUT_FILENO STREAM_MAX S_IRGRP S_IROTH S_IRUSR
58 S_IRWXG S_IRWXO S_IRWXU S_ISBLK S_ISCHR S_ISDIR S_ISFIFO
59 S_ISGID S_ISREG S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP
60 S_IXOTH S_IXUSR TCIFLUSH TCIOFF TCIOFLUSH TCION TCOFLUSH
61 TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW TMP_MAX TOSTOP
62 TZNAME_MAX UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX VEOF VEOL
63 VERASE VINTR VKILL VMIN VQUIT VSTART VSTOP VSUSP VTIME
64 WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED WNOHANG WSTOPSIG
65 WTERMSIG WUNTRACED W_OK X_OK _PC_CHOWN_RESTRICTED
66 _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT _PC_NAME_MAX
67 _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF _PC_VDISABLE
68 _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED
69 _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON
70 _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX
71 _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX
72 _POSIX_PIPE_BUF _POSIX_SAVED_IDS _POSIX_SSIZE_MAX
73 _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VDISABLE
74 _POSIX_VERSION _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK
75 _SC_JOB_CONTROL _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE
76 _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION _exit
77 abort access acos asctime asin assert atan atexit atof atoi
78 atol bsearch calloc ceil cfgetispeed cfgetospeed cfsetispeed
79 cfsetospeed clearerr clock cosh creat ctermid ctime cuserid
80 difftime div dup dup2 errno execl execle execlp execv execve
81 execvp fabs fclose fdopen feof ferror fflush fgetc fgetpos
82 fgets floor fmod fopen fpathconf fprintf fputc fputs fread
83 free freopen frexp fscanf fseek fsetpos fstat fsync ftell
84 fwrite getchar getcwd getegid getenv geteuid getgid getgroups
85 getpid gets getuid isalnum isalpha isatty iscntrl isdigit
86 isgraph islower isprint ispunct isspace isupper isxdigit labs
87 ldexp ldiv localeconv log10 longjmp lseek malloc mblen
88 mbstowcs mbtowc memchr memcmp memcpy memmove memset mkfifo
89 mktime modf offsetof pathconf pause perror pow putc putchar
90 puts qsort raise realloc remove rewind scanf setbuf setgid
91 setjmp setlocale setpgid setsid setuid setvbuf sigaction
92 siglongjmp signal sigpending sigprocmask sigsetjmp sigsuspend
93 sinh sscanf stderr stdin stdout strcat strchr strcmp strcoll
94 strcpy strcspn strerror strftime strlen strncat strncmp
95 strncpy strpbrk strrchr strspn strstr strtod strtok strtol
96 strtoul strxfrm sysconf tan tanh tcdrain tcflow tcflush
97 tcgetattr tcgetpgrp tcsendbreak tcsetattr tcsetpgrp tmpfile
98 tmpnam tolower toupper ttyname tzname tzset uname ungetc
99 vfprintf vprintf vsprintf wcstombs wctomb)],
100 EXPORT_OK => [qw(abs alarm atan2 chdir chmod chown close closedir cos exit
101 exp fcntl fileno fork getc getgrgid getgrnam getlogin
102 getpgrp getppid getpwnam getpwuid gmtime kill lchown link
103 localtime log mkdir nice open opendir pipe printf rand
104 read readdir rename rewinddir rmdir sin sleep sprintf sqrt
76e3b563
PLE
105 srand stat strptime system time times umask unlink utime
106 wait waitpid write)],
57159ffe
NC
107);
108
109plan (tests => 2 * keys %expect);
110
111while (my ($var, $expect) = each %expect) {
112 my $have = *{$POSIX::{$var}}{ARRAY};
113 cmp_ok(@$have, '==', @$expect,
114 "Correct number of entries for \@POSIX::$var");
115 is_deeply([sort @$have], $expect, "Correct entries for \@POSIX::$var");
116}