This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
test for various fatal messages from op.c
[perl5.git] / t / lib / croak / op
CommitLineData
7a44ba35
TC
1__END__
2# NAME OP_HELEM fields
3package Foo;
4use fields qw(a b);
5sub new {
6 my $class = shift;
7 return fields::new($class);
8}
9my Foo $f = Foo->new;
10$f->{c} = 1;
11EXPECT
12No such class field "c" in variable $f of type Foo at - line 8.
13########
14# NAME OP_HSLICE fields
15package Foo;
16use fields qw(a b);
17sub new {
18 my $class = shift;
19 return fields::new($class);
20}
21my Foo $f = Foo->new;
22@$f{"a", "c"} = ( 1, 2 );
23EXPECT
24No such class field "c" in variable $f of type Foo at - line 8.
25########
26# NAME my sub
27my sub foo { }
28EXPECT
29"my sub" not yet implemented at - line 1.
30########
31# NAME delete BAD
32delete $x;
33EXPECT
34delete argument is not a HASH or ARRAY element or slice at - line 1.
35########
36# NAME exists BAD
37exists $x;
38EXPECT
39exists argument is not a HASH or ARRAY element or a subroutine at - line 1.
40########
41# NAME exists non-sub
42exists &foo()
43EXPECT
44exists argument is not a subroutine name at - line 1.