Changeset d00d581 for tests/exceptions
- Timestamp:
- Aug 18, 2021, 2:04:55 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- fe8aa21
- Parents:
- 6d63c14
- Location:
- tests/exceptions
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tests/exceptions/.expect/type-check.txt ¶
r6d63c14 rd00d581 1 exceptions/type-check.cfa: 8:1 error: catch must have pointer to an exception type2 exceptions/type-check.cfa: 9:1 error: catch must have pointer to an exception type3 exceptions/type-check.cfa: 10:1 error: catchResume must have pointer to an exception type4 exceptions/type-check.cfa: 11:1 error: catchResume must have pointer to an exception type1 exceptions/type-check.cfa:6:1 error: catch must have pointer to an exception type 2 exceptions/type-check.cfa:7:1 error: catch must have pointer to an exception type 3 exceptions/type-check.cfa:8:1 error: catchResume must have pointer to an exception type 4 exceptions/type-check.cfa:9:1 error: catchResume must have pointer to an exception type -
TabularUnified tests/exceptions/cancel/coroutine.cfa ¶
r6d63c14 rd00d581 2 2 3 3 #include <coroutine.hfa> 4 #include <exception.hfa>5 4 6 EHM_EXCEPTION(internal_error)();7 EHM_VIRTUAL_TABLE(internal_error, internal_vt);5 exception internal_error {}; 6 vtable(internal_error) internal_vt; 8 7 9 8 coroutine WillCancel {}; -
TabularUnified tests/exceptions/cancel/thread.cfa ¶
r6d63c14 rd00d581 2 2 3 3 #include <thread.hfa> 4 #include <exception.hfa>5 4 6 EHM_EXCEPTION(internal_error)();7 EHM_VIRTUAL_TABLE(internal_error, internal_vt);5 exception internal_error {}; 6 vtable(internal_error) internal_vt; 8 7 9 8 thread WillCancel {}; -
TabularUnified tests/exceptions/conditional.cfa ¶
r6d63c14 rd00d581 4 4 // up the non-trivial exception is reasonable to do. 5 5 6 #include <exception.hfa> 6 exception num_error { 7 int num; 8 }; 7 9 8 EHM_EXCEPTION(num_error)( 9 int num; 10 ); 11 12 EHM_VIRTUAL_TABLE(num_error, num_error_vt); 10 vtable(num_error) num_error_vt; 13 11 14 12 void caught_num_error(int expect, num_error * actual) { -
TabularUnified tests/exceptions/data-except.cfa ¶
r6d63c14 rd00d581 1 1 // Test exceptions that add data but no functionality. 2 2 3 #include <exception.hfa> 4 5 EHM_EXCEPTION(paired)( 3 exception paired { 6 4 int first; 7 5 int second; 8 );6 }; 9 7 10 EHM_VIRTUAL_TABLE(paired, paired_vt);8 vtable(paired) paired_vt; 11 9 12 10 const char * virtual_msg(paired * this) { -
TabularUnified tests/exceptions/defaults.cfa ¶
r6d63c14 rd00d581 4 4 #include <exception.hfa> 5 5 6 EHM_EXCEPTION(log_message)( 6 exception log_message { 7 7 char * msg; 8 );8 }; 9 9 10 10 _EHM_DEFINE_COPY(log_message, ) … … 32 32 33 33 // I don't have a good use case for doing the same with termination. 34 EHM_EXCEPTION(jump)();34 exception jump {}; 35 35 void defaultTerminationHandler(jump &) { 36 36 printf("jump default handler.\n"); 37 37 } 38 38 39 EHM_VIRTUAL_TABLE(jump, jump_vt);39 vtable(jump) jump_vt; 40 40 41 41 void jump_test(void) { … … 48 48 } 49 49 50 EHM_EXCEPTION(first)();51 EHM_VIRTUAL_TABLE(first, first_vt);50 exception first {}; 51 vtable(first) first_vt; 52 52 53 EHM_EXCEPTION(unhandled_exception)();54 EHM_VIRTUAL_TABLE(unhandled_exception, unhandled_vt);53 exception unhandled_exception {}; 54 vtable(unhandled_exception) unhandled_vt; 55 55 56 56 void unhandled_test(void) { … … 69 69 } 70 70 71 EHM_EXCEPTION(second)();72 EHM_VIRTUAL_TABLE(second, second_vt);71 exception second {}; 72 vtable(second) second_vt; 73 73 74 74 void cross_test(void) { -
TabularUnified tests/exceptions/finally.cfa ¶
r6d63c14 rd00d581 1 1 // Finally Clause Tests 2 2 3 #include <exception.hfa>4 3 #include "except-io.hfa" 5 4 6 EHM_EXCEPTION(myth)();5 exception myth {}; 7 6 8 EHM_VIRTUAL_TABLE(myth, myth_vt);7 vtable(myth) myth_vt; 9 8 10 9 int main(int argc, char * argv[]) { -
TabularUnified tests/exceptions/interact.cfa ¶
r6d63c14 rd00d581 1 1 // Testing Interactions Between Termination and Resumption 2 2 3 #include <exception.hfa>4 3 #include "except-io.hfa" 5 4 6 EHM_EXCEPTION(star)();7 EHM_EXCEPTION(moon)();5 exception star {}; 6 exception moon {}; 8 7 9 EHM_VIRTUAL_TABLE(star, star_vt);10 EHM_VIRTUAL_TABLE(moon, moon_vt);8 vtable(star) star_vt; 9 vtable(moon) moon_vt; 11 10 12 11 int main(int argc, char * argv[]) { -
TabularUnified tests/exceptions/polymorphic.cfa ¶
r6d63c14 rd00d581 1 1 // Testing polymophic exception types. 2 2 3 #include <exception.hfa> 3 forall(T &) exception proxy {}; 4 4 5 EHM_FORALL_EXCEPTION(proxy, (T&), (T))(); 6 7 EHM_FORALL_VIRTUAL_TABLE(proxy, (int), proxy_int); 8 EHM_FORALL_VIRTUAL_TABLE(proxy, (char), proxy_char); 5 vtable(proxy(int)) proxy_int; 6 vtable(proxy(char)) proxy_char; 9 7 10 8 void proxy_test(void) { … … 33 31 } 34 32 35 EHM_FORALL_EXCEPTION(cell, (T), (T))( 33 forall(T) exception cell { 36 34 T data; 37 );35 }; 38 36 39 EHM_FORALL_VIRTUAL_TABLE(cell, (int), int_cell);40 EHM_FORALL_VIRTUAL_TABLE(cell, (char), char_cell);41 EHM_FORALL_VIRTUAL_TABLE(cell, (bool), bool_cell);37 vtable(cell(int)) int_cell; 38 vtable(cell(char)) char_cell; 39 vtable(cell(bool)) bool_cell; 42 40 43 41 void cell_test(void) { -
TabularUnified tests/exceptions/resume.cfa ¶
r6d63c14 rd00d581 1 1 // Resumption Exception Tests 2 2 3 #include <exception.hfa>4 3 #include "except-io.hfa" 5 4 6 EHM_EXCEPTION(yin)();7 EHM_EXCEPTION(yang)();8 EHM_EXCEPTION(zen)();5 exception yin {}; 6 exception yang {}; 7 exception zen {}; 9 8 10 EHM_VIRTUAL_TABLE(yin, yin_vt);11 EHM_VIRTUAL_TABLE(yang, yang_vt);12 EHM_VIRTUAL_TABLE(zen, zen_vt);9 vtable(yin) yin_vt; 10 vtable(yang) yang_vt; 11 vtable(zen) zen_vt; 13 12 14 13 void in_void(void); -
TabularUnified tests/exceptions/terminate.cfa ¶
r6d63c14 rd00d581 1 1 // Termination Exception Tests 2 2 3 #include <exception.hfa>4 3 #include "except-io.hfa" 5 4 6 EHM_EXCEPTION(yin)();7 EHM_EXCEPTION(yang)();8 EHM_EXCEPTION(zen)();5 exception yin {}; 6 exception yang {}; 7 exception zen {}; 9 8 10 EHM_VIRTUAL_TABLE(yin, yin_vt);11 EHM_VIRTUAL_TABLE(yang, yang_vt);12 EHM_VIRTUAL_TABLE(zen, zen_vt);9 vtable(yin) yin_vt; 10 vtable(yang) yang_vt; 11 vtable(zen) zen_vt; 13 12 14 13 void in_void(void); -
TabularUnified tests/exceptions/trash.cfa ¶
r6d63c14 rd00d581 1 1 // Make sure throw-catch during unwind does not trash internal data. 2 2 3 #include <exception.hfa> 3 exception yin {}; 4 exception yang {}; 4 5 5 EHM_EXCEPTION(yin)(); 6 EHM_EXCEPTION(yang)(); 7 8 EHM_VIRTUAL_TABLE(yin, yin_vt); 9 EHM_VIRTUAL_TABLE(yang, yang_vt); 6 vtable(yin) yin_vt; 7 vtable(yang) yang_vt; 10 8 11 9 int main(int argc, char * argv[]) { -
TabularUnified tests/exceptions/type-check.cfa ¶
r6d63c14 rd00d581 1 1 // Check that the exception type check works. 2 2 3 #include <exception.hfa> 4 5 EHM_EXCEPTION(truth)(); 3 exception truth {}; 6 4 7 5 int main(int argc, char * argv[]) {
Note: See TracChangeset
for help on using the changeset viewer.