This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #125540] handle already being at EOF while not finding a heredoc terminator
[perl5.git] / t / op / context.t
CommitLineData
3409ec4c
F
1#!./perl
2
ff7e6c8c
DL
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = qw(. ../lib);
6}
3409ec4c 7
1ae3d757 8require "./test.pl";
b7bea5da 9plan( tests => 8 );
3409ec4c
F
10
11sub foo {
12 $a='abcd';
3409ec4c 13 $a=~/(.)/g;
ff7e6c8c 14 cmp_ok($1,'eq','a','context ' . curr_test());
3409ec4c
F
15}
16
17$a=foo;
18@a=foo;
19foo;
ff7e6c8c
DL
20foo(foo);
21
22my $before = curr_test();
23$h{foo} = foo;
24my $after = curr_test();
25
26cmp_ok($after-$before,'==',1,'foo called once')
27 or diag("nr tests: before=$before, after=$after");
b7bea5da
FC
28
29sub context {
30 $cx = qw[void scalar list][wantarray + defined wantarray];
31}
32$_ = sub { context(); BEGIN { } }->();
33is($cx, 'scalar', 'context of { foo(); BEGIN {} }');