summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/ext/POSIX/t/unimplemented.t
blob: 6ee85f683dab47076b8c538442a4d27d7efc8727 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!./perl -w

use strict;
use Test::More;
use Config;

plan(skip_all => "POSIX is unavailable")
    unless $Config{extensions} =~ /\bPOSIX\b/;

require POSIX;

foreach ([atexit => 'C-specific: use END {} instead'],
	 [atof => 'C-specific, stopped'],
	 [atoi => 'C-specific, stopped'],
	 [atol => 'C-specific, stopped'],
	 [bsearch => 'not supplied'],
	 [calloc => 'C-specific, stopped'],
	 [clearerr => \'IO::Handle::clearerr'],
	 [div => 'C-specific: use /, % and int instead'],
	 [execl => 'C-specific, stopped'],
	 [execle => 'C-specific, stopped'],
	 [execlp => 'C-specific, stopped'],
	 [execv => 'C-specific, stopped'],
	 [execve => 'C-specific, stopped'],
	 [execvp => 'C-specific, stopped'],
	 [fclose => \'IO::Handle::close'],
	 [fdopen => \'IO::Handle::new_from_fd'],
	 [feof => \'IO::Handle::eof'],
	 [ferror => \'IO::Handle::error'],
	 [fflush => \'IO::Handle::flush'],
	 [fgetc => \'IO::Handle::getc'],
	 [fgetpos => \'IO::Seekable::getpos'],
	 [fgets => \'IO::Handle::gets'],
	 [fileno => \'IO::Handle::fileno'],
	 [fopen => \'IO::File::open'],
	 [fprintf => 'C-specific: use printf instead'],
	 [fputc => 'C-specific: use print instead'],
	 [fputs => 'C-specific: use print instead'],
	 [fread => 'C-specific: use read instead'],
	 [free => 'C-specific, stopped'],
	 [freopen => 'C-specific: use open instead'],
	 [fscanf => 'C-specific: use <> and regular expressions instead'],
	 [fseek => \'IO::Seekable::seek'],
	 [fsetpos => \'IO::Seekable::setpos'],
	 [fsync => \'IO::Handle::sync'],
	 [ftell => \'IO::Seekable::tell'],
	 [fwrite => 'C-specific: use print instead'],
	 [labs => 'C-specific: use abs instead'],
	 [ldiv => 'C-specific: use /, % and int instead'],
	 [longjmp => 'C-specific: use die instead'],
	 [malloc => 'C-specific, stopped'],
	 [memchr => 'C-specific: use index() instead'],
	 [memcmp => 'C-specific: use eq instead'],
	 [memcpy => 'C-specific: use = instead'],
	 [memmove => 'C-specific: use = instead'],
	 [memset => 'C-specific: use x instead'],
	 [offsetof => 'C-specific, stopped'],
	 [putc => 'C-specific: use print instead'],
	 [putchar => 'C-specific: use print instead'],
	 [puts => 'C-specific: use print instead'],
	 [qsort => 'C-specific: use sort instead'],
	 [rand => 'non-portable, use Perl\'s rand instead'],
	 [realloc => 'C-specific, stopped'],
	 [scanf => 'C-specific: use <> and regular expressions instead'],
	 [setbuf => \'IO::Handle::setbuf'],
	 [setjmp => 'C-specific: use eval {} instead'],
	 [setvbuf => \'IO::Handle::setvbuf'],
	 [siglongjmp => 'C-specific: use die instead'],
	 [sigsetjmp => 'C-specific: use eval {} instead'],
	 [srand => 'not supplied; refer to Perl\'s srand documentation'],
	 [sscanf => 'C-specific: use regular expressions instead'],
	 [strcat => 'C-specific: use .= instead'],
	 [strchr => 'C-specific: use index() instead'],
	 [strcmp => 'C-specific: use eq instead'],
	 [strcpy => 'C-specific: use = instead'],
	 [strcspn => 'C-specific: use regular expressions instead'],
	 [strlen => 'C-specific: use length instead'],
	 [strncat => 'C-specific: use .= instead'],
	 [strncmp => 'C-specific: use eq instead'],
	 [strncpy => 'C-specific: use = instead'],
	 [strpbrk => 'C-specific, stopped'],
	 [strrchr => 'C-specific: use rindex() instead'],
	 [strspn => 'C-specific, stopped'],
	 [strtok => 'C-specific, stopped'],
	 [tmpfile => \'IO::File::new_tmpfile'],
	 [tmpnam => \'use File::Temp'],
	 [ungetc => \'IO::Handle::ungetc'],
	 [vfprintf => 'C-specific, stopped'],
	 [vprintf => 'C-specific, stopped'],
	 [vsprintf => 'C-specific, stopped'],
	 [L_tmpnam => 'C-specific, stopped'],
	) {
    my ($func, $action) = @$_;
    my $expect = ref $action
	? qr/Unimplemented: POSIX::$func\(\): .*$$action(?:\(\))? instead at \(eval/
	: qr/Unimplemented: POSIX::$func\(\): \Q$action\E at \(eval/;
    is(eval "POSIX::$func(); 1", undef, "POSIX::$func fails as expected");
    like($@, $expect, "POSIX::$func gives expected error message");
}

done_testing();