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