xref: /openbsd/gnu/usr.bin/perl/t/lib/croak/pp_sys (revision e5dd7070)
1__END__
2# pp_sys.c
3# NAME pipe() croaks on bad left side [perl #126480]
4# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available"
5my $fh;
6pipe($$5, $fh)
7EXPECT
8Bad symbol for filehandle at - line 3.
9########
10# NAME pipe() croaks on bad right side [perl #126480]
11# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available"
12my $fh;
13pipe($fh, $$5)
14EXPECT
15Bad symbol for filehandle at - line 2.
16########
17# NAME open on global dirhandle
18opendir FOO, ".";
19open FOO, "../harness";
20EXPECT
21Cannot open FOO as a filehandle: it is already open as a dirhandle at - line 2.
22########
23# NAME open on lexical dirhandle
24opendir my $foo, ".";
25open $foo, "../harness";
26EXPECT
27Cannot open $foo as a filehandle: it is already open as a dirhandle at - line 2.
28########
29# NAME open on global utf8 dirhandle
30use utf8;
31use open qw( :utf8 :std );
32use warnings;
33opendir FOO, ".";
34open FOO, "../harness";
35EXPECT
36Cannot open FOO as a filehandle: it is already open as a dirhandle at - line 5.
37########
38# NAME open on lexical utf8 dirhandle
39use utf8;
40use open qw( :utf8 :std );
41use warnings;
42opendir my $foo, ".";
43open $foo, "../harness";
44EXPECT
45Cannot open $foo as a filehandle: it is already open as a dirhandle at - line 5.
46########
47# NAME opendir on global filehandle
48open FOO, "../harness";
49opendir FOO, ".";
50EXPECT
51Cannot open FOO as a dirhandle: it is already open as a filehandle at - line 2.
52########
53# NAME opendir on lexical filehandle
54open my $foo, "../harness";
55opendir $foo, ".";
56EXPECT
57Cannot open $foo as a dirhandle: it is already open as a filehandle at - line 2.
58########
59# NAME opendir on global utf8 filehandle
60use utf8;
61use open qw( :utf8 :std );
62use warnings;
63open FOO, "../harness";
64opendir FOO, ".";
65EXPECT
66Cannot open FOO as a dirhandle: it is already open as a filehandle at - line 5.
67########
68# NAME opendir on lexical utf8 filehandle
69use utf8;
70use open qw( :utf8 :std );
71use warnings;
72open my $foo, "../harness";
73opendir $foo, ".";
74EXPECT
75Cannot open $foo as a dirhandle: it is already open as a filehandle at - line 5.
76########
77# NAME sysread() disallowed on :utf8
78open my $fh, "<:raw", "../harness" or die "# $!";
79my $buf;
80sysread $fh, $buf, 10;
81binmode $fh, ':utf8';
82sysread $fh, $buf, 10;
83EXPECT
84sysread() isn't allowed on :utf8 handles at - line 5.
85########
86# NAME syswrite() disallowed on :utf8
87my $file = "syswwarn.tmp";
88open my $fh, ">:raw", $file or die "# $!";
89syswrite $fh, 'ABC';
90binmode $fh, ':utf8';
91syswrite $fh, 'ABC';
92close $fh;
93END { unlink $file; }
94EXPECT
95syswrite() isn't allowed on :utf8 handles at - line 5.
96########
97# NAME readline() didn't scalar() its argument
98# this would assert rather than failing on the method call
99E{0;readline@0}
100EXPECT
101Can't call method "E" without a package or object reference at - line 2.
102