xref: /openbsd/gnu/usr.bin/perl/t/op/context.t (revision 404b540a)
1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    @INC = qw(. ../lib);
6}
7
8require "test.pl";
9plan( tests => 7 );
10
11sub foo {
12    $a='abcd';
13    $a=~/(.)/g;
14    cmp_ok($1,'eq','a','context ' . curr_test());
15}
16
17$a=foo;
18@a=foo;
19foo;
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");
28