summaryrefslogtreecommitdiff
path: root/t/lib/croak/pp_sys
blob: cf9e4ef0ed83c49291fac5466145bf323af7ca84 (plain)
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
__END__
# pp_sys.c
# NAME pipe() croaks on bad left side [perl #126480]
# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available"
my $fh;
pipe($$5, $fh)
EXPECT
Bad symbol for filehandle at - line 3.
########
# NAME pipe() croaks on bad right side [perl #126480]
# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available"
my $fh;
pipe($fh, $$5)
EXPECT
Bad symbol for filehandle at - line 2.
########
# NAME open on global dirhandle
opendir FOO, ".";
open FOO, "../harness";
EXPECT
Cannot open FOO as a filehandle: it is already open as a dirhandle at - line 2.
########
# NAME open on lexical dirhandle
opendir my $foo, ".";
open $foo, "../harness";
EXPECT
Cannot open $foo as a filehandle: it is already open as a dirhandle at - line 2.
########
# NAME open on global utf8 dirhandle
use utf8;
use open qw( :utf8 :std );
use warnings;
opendir FOO, ".";
open FOO, "../harness";
EXPECT
Cannot open FOO as a filehandle: it is already open as a dirhandle at - line 5.
########
# NAME open on lexical utf8 dirhandle
use utf8;
use open qw( :utf8 :std );
use warnings;
opendir my $foo, ".";
open $foo, "../harness";
EXPECT
Cannot open $foo as a filehandle: it is already open as a dirhandle at - line 5.
########
# NAME opendir on global filehandle
open FOO, "../harness";
opendir FOO, ".";
EXPECT
Cannot open FOO as a dirhandle: it is already open as a filehandle at - line 2.
########
# NAME opendir on lexical filehandle
open my $foo, "../harness";
opendir $foo, ".";
EXPECT
Cannot open $foo as a dirhandle: it is already open as a filehandle at - line 2.
########
# NAME opendir on global utf8 filehandle
use utf8;
use open qw( :utf8 :std );
use warnings;
open FOO, "../harness";
opendir FOO, ".";
EXPECT
Cannot open FOO as a dirhandle: it is already open as a filehandle at - line 5.
########
# NAME opendir on lexical utf8 filehandle
use utf8;
use open qw( :utf8 :std );
use warnings;
open my $foo, "../harness";
opendir $foo, ".";
EXPECT
Cannot open $foo as a dirhandle: it is already open as a filehandle at - line 5.
########
# NAME sysread() disallowed on :utf8
open my $fh, "<:raw", "../harness" or die "# $!";
my $buf;
sysread $fh, $buf, 10;
binmode $fh, ':utf8';
sysread $fh, $buf, 10;
EXPECT
sysread() isn't allowed on :utf8 handles at - line 5.
########
# NAME syswrite() disallowed on :utf8
my $file = "syswwarn.tmp";
open my $fh, ">:raw", $file or die "# $!";
syswrite $fh, 'ABC';
binmode $fh, ':utf8';
syswrite $fh, 'ABC';
close $fh;
END { unlink $file; }
EXPECT
syswrite() isn't allowed on :utf8 handles at - line 5.
########
# NAME readline() didn't scalar() its argument
# this would assert rather than failing on the method call
E{0;readline@0}
EXPECT
Can't call method "E" without a package or object reference at - line 2.