10 my $tmpfile = tempfile();
11 open (tmp,'>', $tmpfile) || die "Can't create Cmd_while.tmp.";
17 close tmp or die "Could not close: $!";
21 open(fh, $tmpfile) || die "Can't open Cmd_while.tmp.";
30 open(fh, $tmpfile) || die "Can't open Cmd_while.tmp.";
35 ok(eof && !/vt100/ && !$bad);
40 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
42 if (s/vt100/VT100/g) {
51 # now do the same with a label and a continue block
56 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
58 if (/vt100/) {last line;}
60 $badcont = 1 if /vt100/;
69 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
71 next entry if /vt100/;
74 $badcont = '' if /vt100/;
76 ok(eof && !/vt100/ && !$bad);
83 open(fh,$tmpfile) || die "Can't open Cmd_while.tmp.";
85 if (s/vt100/VT100/g) {
92 $badcont = 1 if /vt100/;
97 close(fh) || die "Can't close Cmd_while.tmp.";
105 # Check curpm is reset when jumping out of a scope
111 is($` . $& . $', "abc");
112 { # Localize changes to $` and friends
114 redo WHILE if $i == 1;
115 next WHILE if $i == 2;
117 last WHILE if $i == 4;
120 is($` . $& . $', "abc");
122 # check that scope cleanup happens right when there's a continue block
125 my (@got_var, @got_i);
126 while (my $i = ++$var) {
132 ($got_var, $got_i) = ($var, $i);
168 $ok = 0 if defined $x;
180 sub save_context { $_[0] = wantarray; $_[1] }
187 save_context($context, "foo");
190 is(scalar($p->()), 0);
191 is($context, undef, "last statement in while block has 'void' context");
199 save_context($context, "foo");
202 is(scalar($p->()), "foo");
203 is($context, "", "last statement in block has 'scalar' context");
207 # test scope is cleaned