Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
79072805 |
3 | # $RCSfile: do.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:45 $ |
378cc40b |
4 | |
8d063cd8 |
5 | sub foo1 |
6 | { |
7 | print $_[0]; |
8 | 'value'; |
9 | } |
10 | |
11 | sub foo2 |
12 | { |
6d4ff0d2 |
13 | shift; |
8d063cd8 |
14 | print $_[0]; |
15 | $x = 'value'; |
16 | $x; |
17 | } |
18 | |
df739378 |
19 | print "1..18\n"; |
8d063cd8 |
20 | |
21 | $_[0] = "not ok 1\n"; |
22 | $result = do foo1("ok 1\n"); |
23 | print "#2\t:$result: eq :value:\n"; |
551cd33c |
24 | if ($result eq 'value') { print "ok 2\n"; } else { print "not ok 2\n"; } |
25 | if ($_[0] eq "not ok 1\n") { print "ok 3\n"; } else { print "not ok 3\n"; } |
8d063cd8 |
26 | |
27 | $_[0] = "not ok 4\n"; |
28 | $result = do foo2("not ok 4\n","ok 4\n","not ok 4\n"); |
29 | print "#5\t:$result: eq :value:\n"; |
551cd33c |
30 | if ($result eq 'value') { print "ok 5\n"; } else { print "not ok 5\n"; } |
31 | if ($_[0] eq "not ok 4\n") { print "ok 6\n"; } else { print "not ok 6\n"; } |
8d063cd8 |
32 | |
33 | $result = do{print "ok 7\n"; 'value';}; |
34 | print "#8\t:$result: eq :value:\n"; |
551cd33c |
35 | if ($result eq 'value') { print "ok 8\n"; } else { print "not ok 8\n"; } |
378cc40b |
36 | |
37 | sub blather { |
38 | print @_; |
39 | } |
40 | |
41 | do blather("ok 9\n","ok 10\n"); |
42 | @x = ("ok 11\n", "ok 12\n"); |
43 | @y = ("ok 14\n", "ok 15\n"); |
44 | do blather(@x,"ok 13\n",@y); |
df739378 |
45 | |
46 | unshift @INC, '.'; |
47 | |
48 | if (open(DO, ">$$.16")) { |
49 | print DO "print qq{ok 16\n} if defined wantarray && not wantarray\n"; |
50 | close DO; |
51 | } |
52 | |
53 | my $a = do "$$.16"; |
54 | |
55 | if (open(DO, ">$$.17")) { |
56 | print DO "print qq{ok 17\n} if defined wantarray && wantarray\n"; |
57 | close DO; |
58 | } |
59 | |
60 | my @a = do "$$.17"; |
61 | |
62 | if (open(DO, ">$$.18")) { |
63 | print DO "print qq{ok 18\n} if not defined wantarray\n"; |
64 | close DO; |
65 | } |
66 | |
67 | do "$$.18"; |
68 | |
69 | END { |
70 | 1 while unlink("$$.16", "$$.17", "$$.18"); |
71 | } |