This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Introduce pp_lock.
[perl5.git] / t / op / do.t
CommitLineData
8d063cd8
LW
1#!./perl
2
79072805 3# $RCSfile: do.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:45 $
378cc40b 4
8d063cd8
LW
5sub foo1
6{
7 print $_[0];
8 'value';
9}
10
11sub foo2
12{
13 shift(_);
14 print $_[0];
15 $x = 'value';
16 $x;
17}
18
378cc40b 19print "1..15\n";
8d063cd8
LW
20
21$_[0] = "not ok 1\n";
22$result = do foo1("ok 1\n");
23print "#2\t:$result: eq :value:\n";
24if ($result EQ 'value') { print "ok 2\n"; } else { print "not ok 2\n"; }
25if ($_[0] EQ "not ok 1\n") { print "ok 3\n"; } else { print "not ok 3\n"; }
26
27$_[0] = "not ok 4\n";
28$result = do foo2("not ok 4\n","ok 4\n","not ok 4\n");
29print "#5\t:$result: eq :value:\n";
30if ($result EQ 'value') { print "ok 5\n"; } else { print "not ok 5\n"; }
31if ($_[0] EQ "not ok 4\n") { print "ok 6\n"; } else { print "not ok 6\n"; }
32
33$result = do{print "ok 7\n"; 'value';};
34print "#8\t:$result: eq :value:\n";
35if ($result EQ 'value') { print "ok 8\n"; } else { print "not ok 8\n"; }
378cc40b
LW
36
37sub blather {
38 print @_;
39}
40
41do blather("ok 9\n","ok 10\n");
42@x = ("ok 11\n", "ok 12\n");
43@y = ("ok 14\n", "ok 15\n");
44do blather(@x,"ok 13\n",@y);