9 my $tmpfile = tempfile();
10 open (tmp,'>', $tmpfile) || die "Can't create Cmd_while.tmp.";
16 close tmp or die "Could not close: $!";
20 open(fh, $tmpfile) || die "Can't open Cmd_while.tmp.";
29 open(fh, $tmpfile) || die "Can't open Cmd_while.tmp.";
34 ok(eof && !/vt100/ && !$bad);
39 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
41 if (s/vt100/VT100/g) {
50 # now do the same with a label and a continue block
55 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
57 if (/vt100/) {last line;}
59 $badcont = 1 if /vt100/;
68 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
70 next entry if /vt100/;
73 $badcont = '' if /vt100/;
75 ok(eof && !/vt100/ && !$bad);
82 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
84 if (s/vt100/VT100/g) {
91 $badcont = 1 if /vt100/;
96 close(fh) || die "Can't close Cmd_while.tmp.";
104 # Check curpm is reset when jumping out of a scope
110 is($` . $& . $', "abc");
111 { # Localize changes to $` and friends
113 redo WHILE if $i == 1;
114 next WHILE if $i == 2;
116 last WHILE if $i == 4;
119 is($` . $& . $', "abc");
121 # check that scope cleanup happens right when there's a continue block
124 my (@got_var, @got_i);
125 while (my $i = ++$var) {
131 ($got_var, $got_i) = ($var, $i);
167 $ok = 0 if defined $x;
179 sub save_context { $_[0] = wantarray; $_[1] }
186 save_context($context, "foo");
189 is(scalar($p->()), 0);
190 is($context, undef, "last statement in while block has 'void' context");
198 save_context($context, "foo");
201 is(scalar($p->()), "foo");
202 is($context, "", "last statement in block has 'scalar' context");
206 # test scope is cleaned