Changes in tests/exceptions/resume.cfa [ecfd758:7f9968ad]
- File:
-
- 1 edited
-
tests/exceptions/resume.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/resume.cfa
recfd758 r7f9968ad 4 4 #include "except-io.hfa" 5 5 6 EHM_EXCEPTION(yin)(); 7 EHM_EXCEPTION(yang)(); 8 EHM_EXCEPTION(zen)(); 9 10 EHM_VIRTUAL_TABLE(yin, yin_vt); 11 EHM_VIRTUAL_TABLE(yang, yang_vt); 12 EHM_VIRTUAL_TABLE(zen, zen_vt); 6 TRIVIAL_EXCEPTION(yin); 7 TRIVIAL_EXCEPTION(yang); 8 TRIVIAL_EXCEPTION(zen); 9 TRIVIAL_EXCEPTION(moment_of, zen); 13 10 14 11 void in_void(void); 15 12 16 13 int main(int argc, char * argv[]) { 17 yin a_yin = {&yin_vt};18 yang a_yang = {&yang_vt};19 zen a_zen = {&zen_vt};20 21 14 // The simple throw catchResume test. 22 15 try { 23 16 loud_exit a = "simple try clause"; 24 17 printf("simple throw\n"); 25 throwResume a_zen;18 throwResume (zen){}; 26 19 printf("end of try clause\n"); 27 20 } catchResume (zen * error) { … … 33 26 // Throw catch-all test. 34 27 try { 35 throwResume a_zen;28 throwResume (zen){}; 36 29 } catchResume (exception_t * error) { 37 30 printf("catch-all\n"); 31 } 32 printf("\n"); 33 34 // Catch a parent of the given exception. 35 try { 36 printf("throwing child exception\n"); 37 throwResume (moment_of){}; 38 } catchResume (zen *) { 39 printf("inner parent match\n"); 40 } catchResume (moment_of *) { 41 printf("outer exact match\n"); 38 42 } 39 43 printf("\n"); … … 42 46 try { 43 47 try { 44 throwResume a_yin;48 throwResume (yin){}; 45 49 } catchResume (zen *) { 46 50 printf("caught yin as zen\n"); … … 58 62 loud_exit a = "rethrow inner try"; 59 63 printf("rethrow inner try\n"); 60 throwResume a_zen;64 throwResume (zen){}; 61 65 } catchResume (zen *) { 62 66 loud_exit a = "rethrowing catch clause"; … … 73 77 try { 74 78 try { 75 throwResume a_yin;79 throwResume (yin){}; 76 80 } catchResume (yin *) { 77 81 printf("caught yin, will throw yang\n"); 78 throwResume a_yang;82 throwResume (yang){}; 79 83 } catchResume (yang *) { 80 84 printf("caught exception from same try\n"); … … 89 93 try { 90 94 printf("throwing first exception\n"); 91 throwResume a_yin;95 throwResume (yin){}; 92 96 } catchResume (yin *) { 93 97 printf("caught first exception\n"); 94 98 try { 95 99 printf("throwing second exception\n"); 96 throwResume a_yang;100 throwResume (yang){}; 97 101 } catchResume (yang *) { 98 102 printf("caught second exception\n"); … … 110 114 try { 111 115 try { 112 throwResume a_zen;113 throwResume a_zen;116 throwResume (zen){}; 117 throwResume (zen){}; 114 118 } catchResume (zen *) { 115 119 printf("inner catch\n"); 116 120 } 117 throwResume a_zen;121 throwResume (zen){}; 118 122 } catchResume (zen *) { 119 123 printf("outer catch\n"); … … 126 130 // Do a throw and rethrow in a void function. 127 131 void in_void(void) { 128 zen a_zen = {&zen_vt};129 132 try { 130 133 try { 131 134 printf("throw\n"); 132 throwResume a_zen;135 throwResume (zen){}; 133 136 } catchResume (zen *) { 134 137 printf("rethrow\n");
Note:
See TracChangeset
for help on using the changeset viewer.