ADTast-experimentalpthread-emulation
Last change
on this file since 41a6a78 was
d00d581,
checked in by Henry Xue <y58xue@…>, 3 years ago
|
Update exception tests to use new syntax
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | // Finally Clause Tests |
---|
2 | |
---|
3 | #include "except-io.hfa" |
---|
4 | |
---|
5 | exception myth {}; |
---|
6 | |
---|
7 | vtable(myth) myth_vt; |
---|
8 | |
---|
9 | int main(int argc, char * argv[]) { |
---|
10 | myth exc = {&myth_vt}; |
---|
11 | |
---|
12 | try { |
---|
13 | try { |
---|
14 | printf("termination throw\n"); |
---|
15 | throw exc; |
---|
16 | } finally { |
---|
17 | loud_exit a = "termination inner finally"; |
---|
18 | printf("finally during unwind\n"); |
---|
19 | } |
---|
20 | } catch (myth * error) { |
---|
21 | printf("termination catch\n"); |
---|
22 | } finally { |
---|
23 | loud_exit a = "termination outer finally"; |
---|
24 | printf("finally after catch\n"); |
---|
25 | } |
---|
26 | printf("\n"); |
---|
27 | |
---|
28 | try { |
---|
29 | try { |
---|
30 | printf("resumption throw\n"); |
---|
31 | throwResume exc; |
---|
32 | } finally { |
---|
33 | loud_exit a = "resumption inner finally"; |
---|
34 | printf("finally after resume\n"); |
---|
35 | } |
---|
36 | } catchResume (myth * error) { |
---|
37 | printf("resumption catch\n"); |
---|
38 | } finally { |
---|
39 | loud_exit a = "resumption outer finally"; |
---|
40 | printf("finally after catch\n"); |
---|
41 | } |
---|
42 | printf("\n"); |
---|
43 | |
---|
44 | try { |
---|
45 | printf("walking out of try\n"); |
---|
46 | } finally { |
---|
47 | loud_exit a = "walking finally"; |
---|
48 | printf("walking through finally\n"); |
---|
49 | } |
---|
50 | printf("\n"); |
---|
51 | |
---|
52 | try { |
---|
53 | printf("jumping out of try\n"); |
---|
54 | goto endoffunction; |
---|
55 | } finally { |
---|
56 | loud_exit a = "jumping finally"; |
---|
57 | printf("jumping through finally\n"); |
---|
58 | } |
---|
59 | endoffunction: |
---|
60 | ; |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.