Changeset 3bf9d10 for tests/exceptions/defaults.cfa
- Timestamp:
- Jun 21, 2023, 9:45:08 PM (14 months ago)
- Branches:
- master
- Children:
- 6065281f
- Parents:
- 2de175ce
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/defaults.cfa
r2de175ce r3bf9d10 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.