This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make _charnames comparison null-safe
[perl5.git] / t / lib / croak / op
CommitLineData
7a44ba35 1__END__
b14845b4
FC
2# NAME my $<special>
3my $!;
4EXPECT
5Can't use global $! in "my" at - line 1, near "my $!"
6Execution of - aborted due to compilation errors.
7########
7a44ba35
TC
8# NAME OP_HELEM fields
9package Foo;
10use fields qw(a b);
11sub new {
12 my $class = shift;
13 return fields::new($class);
14}
15my Foo $f = Foo->new;
16$f->{c} = 1;
17EXPECT
18No such class field "c" in variable $f of type Foo at - line 8.
19########
e6307ed0
FC
20# NAME "No such field" with block: ${$ref}{key}
21%FIELDS; # empty hash so all keys are invalid
22my main $r;
23${$r}{key};
24EXPECT
25No such class field "key" in variable $r of type main at - line 3.
26########
7a44ba35
TC
27# NAME OP_HSLICE fields
28package Foo;
29use fields qw(a b);
30sub new {
31 my $class = shift;
32 return fields::new($class);
33}
34my Foo $f = Foo->new;
35@$f{"a", "c"} = ( 1, 2 );
36EXPECT
37No such class field "c" in variable $f of type Foo at - line 8.
38########
0e706dd4
FC
39# NAME Single OP_HSLICE field
40%FIELDS; # vivify it, but leave it empty, so all fields are invalid
41my main $f;
42@$f{"a"};
43EXPECT
44No such class field "a" in variable $f of type main at - line 3.
45########
7a44ba35
TC
46# NAME delete BAD
47delete $x;
48EXPECT
49delete argument is not a HASH or ARRAY element or slice at - line 1.
50########
51# NAME exists BAD
52exists $x;
53EXPECT
54exists argument is not a HASH or ARRAY element or a subroutine at - line 1.
55########
56# NAME exists non-sub
57exists &foo()
58EXPECT
59exists argument is not a subroutine name at - line 1.