Changes in tests/exceptions/interact.cfa [3bf9d10:d00d581]
- File:
-
- 1 edited
-
tests/exceptions/interact.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/interact.cfa
r3bf9d10 rd00d581 1 1 // Testing Interactions Between Termination and Resumption 2 2 3 #include <fstream.hfa>4 3 #include "except-io.hfa" 5 4 … … 15 14 throwResume (star){&star_vt}; 16 15 } catch (star *) { 17 sout | "caught as termination";16 printf("caught as termination\n"); 18 17 } 19 18 // Variant of the above to check timing. … … 22 21 throwResume (star){&star_vt}; 23 22 } catch (star *) { 24 sout | "caught as termination";23 printf("caught as termination\n"); 25 24 } catchResume (star *) { 26 sout | "intermediate rethrow";25 printf("intermediate rethrow\n"); 27 26 throwResume; 28 27 } 29 sout | nl;28 printf("\n"); 30 29 31 30 // Resume does not catch terminate. … … 34 33 throw (star){&star_vt}; 35 34 } catchResume (star *) { 36 sout | "resume catch on terminate";35 printf("resume catch on terminate\n"); 37 36 } 38 37 } catchResume (star *) { 39 sout | "resume catch on terminate";38 printf("resume catch on terminate\n"); 40 39 } catch (star *) { 41 sout | "terminate catch on terminate";40 printf("terminate catch on terminate\n"); 42 41 } 43 sout | nl;42 printf("\n"); 44 43 45 44 // Terminate does not catch resume. … … 48 47 throwResume (star){&star_vt}; 49 48 } catch (star *) { 50 sout | "terminate catch on resume";49 printf("terminate catch on resume\n"); 51 50 } 52 51 } catch (star *) { 53 sout | "terminate catch on resume";52 printf("terminate catch on resume\n"); 54 53 } catchResume (star *) { 55 sout | "resume catch on resume";54 printf("resume catch on resume\n"); 56 55 } 57 sout | nl;56 printf("\n"); 58 57 59 58 // Resume a termination exception. … … 63 62 throw (star){&star_vt}; 64 63 } catchResume (star *) { 65 sout | "inner resume catch (error)";64 printf("inner resume catch (error)\n"); 66 65 } 67 66 } catch (star * error) { 68 sout | "termination catch, will resume";67 printf("termination catch, will resume\n"); 69 68 throwResume *error; 70 69 } 71 70 } catchResume (star *) { 72 sout | "outer resume catch";71 printf("outer resume catch\n"); 73 72 } 74 sout | nl;73 printf("\n"); 75 74 76 75 // Terminate a resumption exception. … … 80 79 throwResume (star){&star_vt}; 81 80 } catch (star *) { 82 sout | "inner termination catch";81 printf("inner termination catch\n"); 83 82 } 84 83 } catchResume (star * error) { 85 sout | "resumption catch, will terminate";84 printf("resumption catch, will terminate\n"); 86 85 throw *error; 87 86 } 88 87 } catch (star *) { 89 sout | "outer terminate catch (error)";88 printf("outer terminate catch (error)\n"); 90 89 } 91 sout | nl;90 printf("\n"); 92 91 93 92 // Unwinding a resumption catch does not break the system. … … 96 95 try { 97 96 try { 98 sout | "throwing resume moon";97 printf("throwing resume moon\n"); 99 98 throwResume (moon){&moon_vt}; 100 99 } catch (star *) { 101 sout | "termination catch";100 printf("termination catch\n"); 102 101 } 103 sout | "throwing resume star";102 printf("throwing resume star\n"); 104 103 throwResume (star){&star_vt}; 105 104 } catchResume (star *) { 106 sout | "resumption star catch";105 printf("resumption star catch\n"); 107 106 } 108 107 } catchResume (moon *) { 109 sout | "resumption moon catch, will terminate";108 printf("resumption moon catch, will terminate\n"); 110 109 throw (star){&star_vt}; 111 110 } 112 111 } catchResume (star *) { 113 sout | "outermost catch (error)";112 printf("outermost catch (error)\n"); 114 113 } 115 114 }
Note:
See TracChangeset
for help on using the changeset viewer.