From 264cef28e9f800426234a9e31007e10cc2439aa3 Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Sat, 14 Apr 2001 23:13:59 +0100 Subject: Exit via last, part 1 Message-ID: <20010414221359.A413@blackrider.blackstar.co.uk> p4raw-id: //depot/perl@9711 --- t/op/loopctl.t | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 't/op/loopctl.t') diff --git a/t/op/loopctl.t b/t/op/loopctl.t index a7416f2046..2ed9df1432 100644 --- a/t/op/loopctl.t +++ b/t/op/loopctl.t @@ -31,7 +31,7 @@ # # -- .robin. 2001-03-13 -print "1..39\n"; +print "1..41\n"; my $ok; @@ -923,3 +923,24 @@ TEST39: { } } print ($ok ? "ok 39\n" : "not ok 39\n"); + + +### Test that loop control is dynamicly scoped. + +sub test_last_label { last TEST40 } + +TEST40: { + $ok = 1; + test_last_label(); + $ok = 0; +} +print ($ok ? "ok 40\n" : "not ok 40\n"); + +sub test_last { last } + +TEST41: { + $ok = 1; + test_last(); + $ok = 0; +} +print ($ok ? "ok 41\n" : "not ok 41\n"); -- cgit v1.2.1