From 72f60de3c4fffd0ba68e9ea2bb833376dec9cd64 Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 18 Oct 2015 14:48:36 +0000 Subject: [PATCH] * Added two test cases from Mantis #28584. The issue itself has been fixed with r31475 and r31582. git-svn-id: trunk@32092 - --- tests/test/cg/ttryfin5.pp | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/test/cg/ttryfin5.pp b/tests/test/cg/ttryfin5.pp index f621742c20..92785971e5 100644 --- a/tests/test/cg/ttryfin5.pp +++ b/tests/test/cg/ttryfin5.pp @@ -52,6 +52,51 @@ begin end; end; +{ test 4: 'continue' in try..except nested in loop nested in try..finally + in this case the control stays within protected region + (Mantis #28584) } +procedure test4; +var + i: integer; +begin + try + for i:=0 to 2 do + begin + try + inc(counter); + raise exception.create('catch me'); + except + continue; + end; + end; + finally + inc(counter); + end; +end; + +{ test 5: same as above but with 'break' statement instead } +procedure test5; +var + i: integer; +begin + try + for i:=0 to 15 do + begin + try + inc(counter); + raise exception.create('catch me'); + except + if i=2 then + break; + end; + end; + inc(counter); + finally + inc(counter); + end; +end; + + begin counter:=0; @@ -68,4 +113,14 @@ begin test3; if counter<>2 then Halt(3); + + counter:=0; + test4; + if counter<>4 then + Halt(4); + + counter:=0; + test5; + if counter<>5 then + Halt(5); end.