This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reorder t/lib/croak/toke
[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########
c5f75dba
FC
46# NAME OP_KVHSLICE fields
47BEGIN { %FIELDS = qw(a 1 b 1); }
48my main $f;
49%$f{"a","c"};
50EXPECT
51No such class field "c" in variable $f of type main at - line 3.
52########
4748e002
FC
53# NAME Can't declare conditional
54my($a?$b:$c)
55EXPECT
56Can't declare conditional expression in "my" at - line 1, at EOF
57Execution of - aborted due to compilation errors.
58########
59# NAME Can't declare do block
60my(do{})
61EXPECT
62Can't declare do block in "my" at - line 1, at EOF
63Execution of - aborted due to compilation errors.
64########
7a44ba35
TC
65# NAME delete BAD
66delete $x;
67EXPECT
68delete argument is not a HASH or ARRAY element or slice at - line 1.
69########
2186f873
FC
70# NAME delete sort
71use warnings;
72delete sort; # used to warn about scalar context, too
73EXPECT
74delete argument is not a HASH or ARRAY element or slice at - line 2.
75########
7a44ba35
TC
76# NAME exists BAD
77exists $x;
78EXPECT
79exists argument is not a HASH or ARRAY element or a subroutine at - line 1.
80########
81# NAME exists non-sub
82exists &foo()
83EXPECT
84exists argument is not a subroutine name at - line 1.
b5adc3e5
DIM
85########
86# NAME push BAREWORD
87no warnings 'experimental';
88push FRED;
89EXPECT
90Type of arg 1 to push must be array (not constant item) at - line 2, near "FRED;"
91Execution of - aborted due to compilation errors.
92########
93# NAME pop BAREWORD
94no warnings 'experimental';
95pop FRED;
96EXPECT
97Type of arg 1 to pop must be array (not constant item) at - line 2, near "FRED;"
98Execution of - aborted due to compilation errors.
99########
100# NAME shift BAREWORD
101no warnings 'experimental';
102shift FRED;
103EXPECT
104Type of arg 1 to shift must be array (not constant item) at - line 2, near "FRED;"
105Execution of - aborted due to compilation errors.
106########
107# NAME unshift BAREWORD
108no warnings 'experimental';
109unshift FRED;
110EXPECT
111Type of arg 1 to unshift must be array (not constant item) at - line 2, near "FRED;"
112Execution of - aborted due to compilation errors.
113########
114# NAME keys BAREWORD
115@a = keys FRED ;
116EXPECT
117Type of arg 1 to keys must be hash (not constant item) at - line 1, near "FRED ;"
118Execution of - aborted due to compilation errors.
119########
120# NAME values BAREWORD
121@a = values FRED ;
122EXPECT
123Type of arg 1 to values must be hash (not constant item) at - line 1, near "FRED ;"
124Execution of - aborted due to compilation errors.
125########
126# NAME each BAREWORD
127@a = each FRED ;
128EXPECT
129Type of arg 1 to each must be hash (not constant item) at - line 1, near "FRED ;"
130Execution of - aborted due to compilation errors.