Changes in tests/exceptions/terminate.cfa [ecfd758:5715d43]
- File:
-
- 1 edited
-
tests/exceptions/terminate.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/terminate.cfa
recfd758 r5715d43 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 catch test. 22 15 try { 23 16 loud_exit a = "simple try clause"; 24 17 printf("simple throw\n"); 25 throw a_zen;18 throw (zen){}; 26 19 printf("end of try clause\n"); 27 20 } catch (zen * error) { … … 33 26 // Throw catch-all test. 34 27 try { 35 throw a_zen;28 throw (zen){}; 36 29 } catch (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 throw (moment_of){}; 38 } catch (zen *) { 39 printf("inner parent match\n"); 40 } catch (moment_of *) { 41 printf("outer exact match\n"); 38 42 } 39 43 printf("\n"); … … 42 46 try { 43 47 try { 44 throw a_yin;48 throw (yin){}; 45 49 } catch (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 throw a_zen;64 throw (zen){}; 61 65 } catch (zen *) { 62 66 loud_exit a = "rethrowing catch clause"; … … 73 77 try { 74 78 try { 75 throw a_yin;79 throw (yin){}; 76 80 } catch (yin *) { 77 81 printf("caught yin, will throw yang\n"); 78 throw a_yang;82 throw (yang){}; 79 83 } catch (yang *) { 80 84 printf("caught exception from same try\n"); … … 89 93 try { 90 94 printf("throwing first exception\n"); 91 throw a_yin;95 throw (yin){}; 92 96 } catch (yin *) { 93 97 printf("caught first exception\n"); 94 98 try { 95 99 printf("throwing second exception\n"); 96 throw a_yang;100 throw (yang){}; 97 101 } catch (yang *) { 98 102 printf("caught second exception\n"); … … 110 114 try { 111 115 try { 112 throw a_zen;113 throw a_zen;116 throw (zen){}; 117 throw (zen){}; 114 118 } catch (zen *) { 115 119 printf("inner catch\n"); 116 120 } 117 throw a_zen;121 throw (zen){}; 118 122 } catch (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 throw a_zen;135 throw (zen){}; 133 136 } catch (zen *) { 134 137 printf("rethrow\n");
Note:
See TracChangeset
for help on using the changeset viewer.