Changeset d00d581 for tests


Ignore:
Timestamp:
Aug 18, 2021, 2:04:55 PM (3 years ago)
Author:
Henry Xue <y58xue@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
fe8aa21
Parents:
6d63c14
Message:

Update exception tests to use new syntax

Location:
tests/exceptions
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/.expect/type-check.txt

    r6d63c14 rd00d581  
    1 exceptions/type-check.cfa:8:1 error: catch must have pointer to an exception type
    2 exceptions/type-check.cfa:9:1 error: catch must have pointer to an exception type
    3 exceptions/type-check.cfa:10:1 error: catchResume must have pointer to an exception type
    4 exceptions/type-check.cfa:11:1 error: catchResume must have pointer to an exception type
     1exceptions/type-check.cfa:6:1 error: catch must have pointer to an exception type
     2exceptions/type-check.cfa:7:1 error: catch must have pointer to an exception type
     3exceptions/type-check.cfa:8:1 error: catchResume must have pointer to an exception type
     4exceptions/type-check.cfa:9:1 error: catchResume must have pointer to an exception type
  • tests/exceptions/cancel/coroutine.cfa

    r6d63c14 rd00d581  
    22
    33#include <coroutine.hfa>
    4 #include <exception.hfa>
    54
    6 EHM_EXCEPTION(internal_error)();
    7 EHM_VIRTUAL_TABLE(internal_error, internal_vt);
     5exception internal_error {};
     6vtable(internal_error) internal_vt;
    87
    98coroutine WillCancel {};
  • tests/exceptions/cancel/thread.cfa

    r6d63c14 rd00d581  
    22
    33#include <thread.hfa>
    4 #include <exception.hfa>
    54
    6 EHM_EXCEPTION(internal_error)();
    7 EHM_VIRTUAL_TABLE(internal_error, internal_vt);
     5exception internal_error {};
     6vtable(internal_error) internal_vt;
    87
    98thread WillCancel {};
  • tests/exceptions/conditional.cfa

    r6d63c14 rd00d581  
    44// up the non-trivial exception is reasonable to do.
    55
    6 #include <exception.hfa>
     6exception num_error {
     7        int num;
     8};
    79
    8 EHM_EXCEPTION(num_error)(
    9         int num;
    10 );
    11 
    12 EHM_VIRTUAL_TABLE(num_error, num_error_vt);
     10vtable(num_error) num_error_vt;
    1311
    1412void caught_num_error(int expect, num_error * actual) {
  • tests/exceptions/data-except.cfa

    r6d63c14 rd00d581  
    11// Test exceptions that add data but no functionality.
    22
    3 #include <exception.hfa>
    4 
    5 EHM_EXCEPTION(paired)(
     3exception paired {
    64        int first;
    75        int second;
    8 );
     6};
    97
    10 EHM_VIRTUAL_TABLE(paired, paired_vt);
     8vtable(paired) paired_vt;
    119
    1210const char * virtual_msg(paired * this) {
  • tests/exceptions/defaults.cfa

    r6d63c14 rd00d581  
    44#include <exception.hfa>
    55
    6 EHM_EXCEPTION(log_message)(
     6exception log_message {
    77        char * msg;
    8 );
     8};
    99
    1010_EHM_DEFINE_COPY(log_message, )
     
    3232
    3333// I don't have a good use case for doing the same with termination.
    34 EHM_EXCEPTION(jump)();
     34exception jump {};
    3535void defaultTerminationHandler(jump &) {
    3636        printf("jump default handler.\n");
    3737}
    3838
    39 EHM_VIRTUAL_TABLE(jump, jump_vt);
     39vtable(jump) jump_vt;
    4040
    4141void jump_test(void) {
     
    4848}
    4949
    50 EHM_EXCEPTION(first)();
    51 EHM_VIRTUAL_TABLE(first, first_vt);
     50exception first {};
     51vtable(first) first_vt;
    5252
    53 EHM_EXCEPTION(unhandled_exception)();
    54 EHM_VIRTUAL_TABLE(unhandled_exception, unhandled_vt);
     53exception unhandled_exception {};
     54vtable(unhandled_exception) unhandled_vt;
    5555
    5656void unhandled_test(void) {
     
    6969}
    7070
    71 EHM_EXCEPTION(second)();
    72 EHM_VIRTUAL_TABLE(second, second_vt);
     71exception second {};
     72vtable(second) second_vt;
    7373
    7474void cross_test(void) {
  • tests/exceptions/finally.cfa

    r6d63c14 rd00d581  
    11// Finally Clause Tests
    22
    3 #include <exception.hfa>
    43#include "except-io.hfa"
    54
    6 EHM_EXCEPTION(myth)();
     5exception myth {};
    76
    8 EHM_VIRTUAL_TABLE(myth, myth_vt);
     7vtable(myth) myth_vt;
    98
    109int main(int argc, char * argv[]) {
  • tests/exceptions/interact.cfa

    r6d63c14 rd00d581  
    11// Testing Interactions Between Termination and Resumption
    22
    3 #include <exception.hfa>
    43#include "except-io.hfa"
    54
    6 EHM_EXCEPTION(star)();
    7 EHM_EXCEPTION(moon)();
     5exception star {};
     6exception moon {};
    87
    9 EHM_VIRTUAL_TABLE(star, star_vt);
    10 EHM_VIRTUAL_TABLE(moon, moon_vt);
     8vtable(star) star_vt;
     9vtable(moon) moon_vt;
    1110
    1211int main(int argc, char * argv[]) {
  • tests/exceptions/polymorphic.cfa

    r6d63c14 rd00d581  
    11// Testing polymophic exception types.
    22
    3 #include <exception.hfa>
     3forall(T &) exception proxy {};
    44
    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);
     5vtable(proxy(int)) proxy_int;
     6vtable(proxy(char)) proxy_char;
    97
    108void proxy_test(void) {
     
    3331}
    3432
    35 EHM_FORALL_EXCEPTION(cell, (T), (T))(
     33forall(T) exception cell {
    3634        T data;
    37 );
     35};
    3836
    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);
     37vtable(cell(int)) int_cell;
     38vtable(cell(char)) char_cell;
     39vtable(cell(bool)) bool_cell;
    4240
    4341void cell_test(void) {
  • tests/exceptions/resume.cfa

    r6d63c14 rd00d581  
    11// Resumption Exception Tests
    22
    3 #include <exception.hfa>
    43#include "except-io.hfa"
    54
    6 EHM_EXCEPTION(yin)();
    7 EHM_EXCEPTION(yang)();
    8 EHM_EXCEPTION(zen)();
     5exception yin {};
     6exception yang {};
     7exception zen {};
    98
    10 EHM_VIRTUAL_TABLE(yin, yin_vt);
    11 EHM_VIRTUAL_TABLE(yang, yang_vt);
    12 EHM_VIRTUAL_TABLE(zen, zen_vt);
     9vtable(yin) yin_vt;
     10vtable(yang) yang_vt;
     11vtable(zen) zen_vt;
    1312
    1413void in_void(void);
  • tests/exceptions/terminate.cfa

    r6d63c14 rd00d581  
    11// Termination Exception Tests
    22
    3 #include <exception.hfa>
    43#include "except-io.hfa"
    54
    6 EHM_EXCEPTION(yin)();
    7 EHM_EXCEPTION(yang)();
    8 EHM_EXCEPTION(zen)();
     5exception yin {};
     6exception yang {};
     7exception zen {};
    98
    10 EHM_VIRTUAL_TABLE(yin, yin_vt);
    11 EHM_VIRTUAL_TABLE(yang, yang_vt);
    12 EHM_VIRTUAL_TABLE(zen, zen_vt);
     9vtable(yin) yin_vt;
     10vtable(yang) yang_vt;
     11vtable(zen) zen_vt;
    1312
    1413void in_void(void);
  • tests/exceptions/trash.cfa

    r6d63c14 rd00d581  
    11// Make sure throw-catch during unwind does not trash internal data.
    22
    3 #include <exception.hfa>
     3exception yin {};
     4exception yang {};
    45
    5 EHM_EXCEPTION(yin)();
    6 EHM_EXCEPTION(yang)();
    7 
    8 EHM_VIRTUAL_TABLE(yin, yin_vt);
    9 EHM_VIRTUAL_TABLE(yang, yang_vt);
     6vtable(yin) yin_vt;
     7vtable(yang) yang_vt;
    108
    119int main(int argc, char * argv[]) {
  • tests/exceptions/type-check.cfa

    r6d63c14 rd00d581  
    11// Check that the exception type check works.
    22
    3 #include <exception.hfa>
    4 
    5 EHM_EXCEPTION(truth)();
     3exception truth {};
    64
    75int main(int argc, char * argv[]) {
Note: See TracChangeset for help on using the changeset viewer.