source: tests/exceptions/interact.cfa @ 6d43cdde

arm-ehenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-expr
Last change on this file since 6d43cdde was 6d43cdde, checked in by Andrew Beach <ajbeach@…>, 2 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// Testing Interactions Between Termination and Resumption
2
3#include "except-mac.hfa"
4#include "except-io.hfa"
5
6TRIVIAL_EXCEPTION(star);
7
8int main(int argc, char * argv[]) {
9        // Resume falls back to terminate.
10        try {
11                THROW_RESUME(&(star){});
12        } catch (star *) {
13                printf("caught as termination\n");
14        }
15        // Variant of the above to check timing.
16        try {
17                loud_region a = "try block with resume throw";
18                THROW_RESUME(&(star){});
19        } catch (star *) {
20                printf("caught as termination\n");
21        } catchResume (star *) {
22                printf("intermediate rethrow\n");
23                throwResume;
24        }
25        printf("\n");
26
27        // Resume does not catch terminate.
28        try {
29                try {
30                        THROW(&(star){});
31                } catchResume (star *) {
32                        printf("resume catch on terminate\n");
33                }
34        } catchResume (star *) {
35                printf("resume catch on terminate\n");
36        } catch (star *) {
37                printf("terminate catch on terminate\n");
38        }
39        printf("\n");
40
41        // Terminate does not catch resume.
42        try {
43                try {
44                        THROW_RESUME(&(star){});
45                } catch (star *) {
46                        printf("terminate catch on resume\n");
47                }
48        } catch (star *) {
49                printf("terminate catch on resume\n");
50        } catchResume (star *) {
51                printf("resume catch on resume\n");
52        }
53}
Note: See TracBrowser for help on using the repository browser.