Changeset 046a890 for tests


Ignore:
Timestamp:
May 19, 2020, 5:31:20 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
918b90c
Parents:
7d6e01d
Message:

That should get default operations working for throws. More tests to come.

Location:
tests/exceptions
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/conditional.cfa

    r7d6e01d r046a890  
    5656
    5757        try {
    58                 throw &exc;
     58                throw exc;
    5959        } catch (num_error * error ; 3 == error->virtual_table->code( error )) {
    6060                caught_num_error(3, error);
     
    6464
    6565        try {
    66                 throwResume &exc;
     66                throwResume exc;
    6767        } catchResume (num_error * error ; 3 == error->virtual_table->code( error )) {
    6868                caught_num_error(3, error);
  • tests/exceptions/data-except.cfa

    r7d6e01d r046a890  
    2828
    2929        try {
    30                 throw &except;
     30                throw except;
    3131        } catch (paired * exc) {
    3232                printf("%s(%d, %d)\n", paired_msg(exc), exc->first, exc->second);
     
    3737
    3838        try {
    39                 throwResume &except;
     39                throwResume except;
    4040        } catchResume (paired * exc) {
    4141                printf("%s(%d, %d)\n", paired_msg(exc), exc->first, exc->second);
  • tests/exceptions/finally.cfa

    r7d6e01d r046a890  
    1212                try {
    1313                        printf("termination throw\n");
    14                         throw &exc;
     14                        throw exc;
    1515                } finally {
    1616                        loud_exit a = "termination inner finally";
     
    2828                try {
    2929                        printf("resumption throw\n");
    30                         throwResume &exc;
     30                        throwResume exc;
    3131                } finally {
    3232                        loud_exit a = "resumption inner finally";
  • tests/exceptions/interact.cfa

    r7d6e01d r046a890  
    1010        // Resume falls back to terminate.
    1111        try {
    12                 throwResume &(star){};
     12                throwResume (star){};
    1313        } catch (star *) {
    1414                printf("caught as termination\n");
     
    1717        try {
    1818                loud_region a = "try block with resume throw";
    19                 throwResume &(star){};
     19                throwResume (star){};
    2020        } catch (star *) {
    2121                printf("caught as termination\n");
     
    2929        try {
    3030                try {
    31                         throw &(star){};
     31                        throw (star){};
    3232                } catchResume (star *) {
    3333                        printf("resume catch on terminate\n");
     
    4343        try {
    4444                try {
    45                         throwResume &(star){};
     45                        throwResume (star){};
    4646                } catch (star *) {
    4747                        printf("terminate catch on resume\n");
     
    5858                try {
    5959                        try {
    60                                 throw &(star){};
     60                                throw (star){};
    6161                        } catchResume (star *) {
    6262                                printf("inner resume catch (error)\n");
     
    6464                } catch (star * error) {
    6565                        printf("termination catch, will resume\n");
    66                         throwResume error;
     66                        throwResume *error;
    6767                }
    6868        } catchResume (star *) {
     
    7575                try {
    7676                        try {
    77                                 throwResume &(star){};
     77                                throwResume (star){};
    7878                        } catch (star *) {
    7979                                printf("inner termination catch\n");
     
    8181                } catchResume (star * error) {
    8282                        printf("resumption catch, will terminate\n");
    83                         throw error;
     83                        throw *error;
    8484                }
    8585        } catch (star *) {
     
    9494                                try {
    9595                                        printf("throwing resume moon\n");
    96                                         throwResume &(moon){};
     96                                        throwResume (moon){};
    9797                                } catch (star *) {
    9898                                        printf("termination catch\n");
    9999                                }
    100100                                printf("throwing resume star\n");
    101                                 throwResume &(star){};
     101                                throwResume (star){};
    102102                        } catchResume (star *) {
    103103                                printf("resumption star catch\n");
     
    105105                } catchResume (moon *) {
    106106                        printf("resumption moon catch, will terminate\n");
    107                         throw &(star){};
     107                        throw (star){};
    108108                }
    109109        } catchResume (star *) {
  • tests/exceptions/resume.cfa

    r7d6e01d r046a890  
    1414                loud_exit a = "simple try clause";
    1515                printf("simple throw\n");
    16                 throwResume &(zen){};
     16                throwResume (zen){};
    1717                printf("end of try clause\n");
    1818        } catchResume (zen * error) {
     
    2424        // Throw catch-all test.
    2525        try {
    26                 throwResume &(zen){};
     26                throwResume (zen){};
    2727        } catchResume (exception_t * error) {
    2828                printf("catch-all\n");
     
    3333        try {
    3434                printf("throwing child exception\n");
    35                 throwResume &(moment_of){};
     35                throwResume (moment_of){};
    3636        } catchResume (zen *) {
    3737                printf("inner parent match\n");
     
    4444        try {
    4545                try {
    46                         throwResume &(yin){};
     46                        throwResume (yin){};
    4747                } catchResume (zen *) {
    4848                        printf("caught yin as zen\n");
     
    6060                        loud_exit a = "rethrow inner try";
    6161                        printf("rethrow inner try\n");
    62                         throwResume &(zen){};
     62                        throwResume (zen){};
    6363                } catchResume (zen *) {
    6464                        loud_exit a = "rethrowing catch clause";
     
    7575        try {
    7676                try {
    77                         throwResume &(yin){};
     77                        throwResume (yin){};
    7878                } catchResume (yin *) {
    7979                        printf("caught yin, will throw yang\n");
    80                         throwResume &(yang){};
     80                        throwResume (yang){};
    8181                } catchResume (yang *) {
    8282                        printf("caught exception from same try\n");
     
    9191                try {
    9292                        printf("throwing first exception\n");
    93                         throwResume &(yin){};
     93                        throwResume (yin){};
    9494                } catchResume (yin *) {
    9595                        printf("caught first exception\n");
    9696                        try {
    9797                                printf("throwing second exception\n");
    98                                 throwResume &(yang){};
     98                                throwResume (yang){};
    9999                        } catchResume (yang *) {
    100100                                printf("caught second exception\n");
     
    112112        try {
    113113                try {
    114                         throwResume &(zen){};
    115                         throwResume &(zen){};
     114                        throwResume (zen){};
     115                        throwResume (zen){};
    116116                } catchResume (zen *) {
    117117                        printf("inner catch\n");
    118118                }
    119                 throwResume &(zen){};
     119                throwResume (zen){};
    120120        } catchResume (zen *) {
    121121                printf("outer catch\n");
  • tests/exceptions/terminate.cfa

    r7d6e01d r046a890  
    1414                loud_exit a = "simple try clause";
    1515                printf("simple throw\n");
    16                 throw &(zen){};
     16                throw (zen){};
    1717                printf("end of try clause\n");
    1818        } catch (zen * error) {
     
    2424        // Throw catch-all test.
    2525        try {
    26                 throw &(zen){};
     26                throw (zen){};
    2727        } catch (exception_t * error) {
    2828                printf("catch-all\n");
     
    3333        try {
    3434                printf("throwing child exception\n");
    35                 throw &(moment_of){};
     35                throw (moment_of){};
    3636        } catch (zen *) {
    3737                printf("inner parent match\n");
     
    4444        try {
    4545                try {
    46                         throw &(yin){};
     46                        throw (yin){};
    4747                } catch (zen *) {
    4848                        printf("caught yin as zen\n");
     
    6060                        loud_exit a = "rethrow inner try";
    6161                        printf("rethrow inner try\n");
    62                         throw &(zen){};
     62                        throw (zen){};
    6363                } catch (zen *) {
    6464                        loud_exit a = "rethrowing catch clause";
     
    7575        try {
    7676                try {
    77                         throw &(yin){};
     77                        throw (yin){};
    7878                } catch (yin *) {
    7979                        printf("caught yin, will throw yang\n");
    80                         throw &(yang){};
     80                        throw (yang){};
    8181                } catch (yang *) {
    8282                        printf("caught exception from same try\n");
     
    9191                try {
    9292                        printf("throwing first exception\n");
    93                         throw &(yin){};
     93                        throw (yin){};
    9494                } catch (yin *) {
    9595                        printf("caught first exception\n");
    9696                        try {
    9797                                printf("throwing second exception\n");
    98                                 throw &(yang){};
     98                                throw (yang){};
    9999                        } catch (yang *) {
    100100                                printf("caught second exception\n");
     
    112112        try {
    113113                try {
    114                         throw &(zen){};
    115                         throw &(zen){};
     114                        throw (zen){};
     115                        throw (zen){};
    116116                } catch (zen *) {
    117117                        printf("inner catch\n");
    118118                }
    119                 throw &(zen){};
     119                throw (zen){};
    120120        } catch (zen *) {
    121121                printf("outer catch\n");
Note: See TracChangeset for help on using the changeset viewer.