source: tests/exceptions/finally.cfa@ 73530d9

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 73530d9 was 6d43cdde, checked in by Andrew Beach <ajbeach@…>, 5 years ago

Rework of exception tests. Includes a new disabled failing test case.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1// Finally Clause Tests
2
3#include "except-mac.hfa"
4#include "except-io.hfa"
5
6TRIVIAL_EXCEPTION(myth);
7
8int main(int argc, char * argv[]) {
9 myth exc;
10
11 try {
12 try {
13 printf("termination throw\n");
14 THROW(&exc);
15 } finally {
16 loud_exit a = "termination inner finally";
17 printf("finally during unwind\n");
18 }
19 } catch (myth * error) {
20 printf("termination catch\n");
21 } finally {
22 loud_exit a = "termination outer finally";
23 printf("finally after catch\n");
24 }
25 printf("\n");
26
27 try {
28 try {
29 printf("resumption throw\n");
30 THROW_RESUME(&exc);
31 } finally {
32 loud_exit a = "resumption inner finally";
33 printf("finally after resume\n");
34 }
35 } catchResume (myth * error) {
36 printf("resumption catch\n");
37 } finally {
38 loud_exit a = "resumption outer finally";
39 printf("finally after catch\n");
40 }
41 printf("\n");
42
43 try {
44 printf("walking out of try\n");
45 } finally {
46 loud_exit a = "walking finally";
47 printf("walking through finally\n");
48 }
49 printf("\n");
50
51 try {
52 printf("jumping out of try\n");
53 goto endoffunction;
54 } finally {
55 loud_exit a = "jumping finally";
56 printf("jumping through finally\n");
57 }
58 endoffunction:
59 ;
60}
Note: See TracBrowser for help on using the repository browser.