Changeset 48ec19a for tests/exceptions/defaults.cfa
- Timestamp:
- Jun 26, 2023, 10:51:47 AM (2 years ago)
- Branches:
- master
- Children:
- 917e1fd
- Parents:
- adc73a5 (diff), 1fbf481 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/defaults.cfa
radc73a5 r48ec19a 1 1 // Tests for providing new default operations. 2 2 3 #include <fstream.hfa> 3 4 #include <string.h> 4 5 … … 35 36 throwResume (log_message){&log_vt, "Should be printed.\n"}; 36 37 } catchResume (log_message * this) { 37 printf("%s", this->virtual_table->msg(this));38 sout | this->virtual_table->msg(this) | nonl; 38 39 } 39 40 // But we don't have to: … … 44 45 exception jump {}; 45 46 void defaultTerminationHandler(jump &) { 46 printf("jump default handler.\n");47 sout | "jump default handler."; 47 48 } 48 49 … … 53 54 throw (jump){&jump_vt}; 54 55 } catch (jump * this) { 55 printf("jump catch handler.\n");56 sout | "jump catch handler."; 56 57 } 57 58 throw (jump){&jump_vt}; … … 75 76 throw (first){&first_vt}; 76 77 } catch (unhandled_exception * t) { 77 printf("Catch unhandled_exception.\n");78 sout | "Catch unhandled_exception."; 78 79 } 79 80 } … … 84 85 void cross_test(void) { 85 86 void defaultTerminationHandler(first &) { 86 printf("cross terminate default\n");87 sout | "cross terminate default"; 87 88 throw (second){&second_vt}; 88 89 } 89 90 void defaultResumptionHandler(first &) { 90 printf("cross resume default\n");91 sout | "cross resume default"; 91 92 throwResume (second){&second_vt}; 92 93 } 93 94 try { 94 printf("cross terminate throw\n");95 sout | "cross terminate throw"; 95 96 throw (first){&first_vt}; 96 97 } catch (second *) { 97 printf("cross terminate catch\n");98 sout | "cross terminate catch"; 98 99 } 99 100 try { 100 printf("cross resume throw\n");101 sout | "cross resume throw"; 101 102 throwResume (first){&first_vt}; 102 103 } catchResume (second *) { 103 printf("cross resume catch\n");104 sout | "cross resume catch"; 104 105 } 105 106 }
Note:
See TracChangeset
for help on using the changeset viewer.