Changeset 7f9968a for tests


Ignore:
Timestamp:
Jun 24, 2020, 12:30:42 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:
8b58bae
Parents:
a8a3485
Message:

Fixed a problem with 'throwResume;' translation and added some tests to check for similar problems.

Location:
tests/exceptions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/.expect/resume.txt

    ra8a3485 r7f9968a  
    3131inner catch
    3232outer catch
     33
     34throw
     35rethrow
     36handle
  • tests/exceptions/.expect/terminate.txt

    ra8a3485 r7f9968a  
    2929inner catch
    3030outer catch
     31
     32throw
     33rethrow
     34handle
  • tests/exceptions/resume.cfa

    ra8a3485 r7f9968a  
    88TRIVIAL_EXCEPTION(zen);
    99TRIVIAL_EXCEPTION(moment_of, zen);
     10
     11void in_void(void);
    1012
    1113int main(int argc, char * argv[]) {
     
    121123                printf("outer catch\n");
    122124        }
     125        printf("\n");
     126
     127        in_void();
    123128}
     129
     130// Do a throw and rethrow in a void function.
     131void in_void(void) {
     132        try {
     133                try {
     134                        printf("throw\n");
     135                        throwResume (zen){};
     136                } catchResume (zen *) {
     137                        printf("rethrow\n");
     138                        throwResume;
     139                }
     140        } catchResume (zen *) {
     141                printf("handle\n");
     142        }
     143}
  • tests/exceptions/terminate.cfa

    ra8a3485 r7f9968a  
    88TRIVIAL_EXCEPTION(zen);
    99TRIVIAL_EXCEPTION(moment_of, zen);
     10
     11void in_void(void);
    1012
    1113int main(int argc, char * argv[]) {
     
    121123                printf("outer catch\n");
    122124        }
     125        printf("\n");
     126
     127        in_void();
    123128}
     129
     130// Do a throw and rethrow in a void function.
     131void in_void(void) {
     132        try {
     133                try {
     134                        printf("throw\n");
     135                        throw (zen){};
     136                } catch (zen *) {
     137                        printf("rethrow\n");
     138                        throw;
     139                }
     140        } catch (zen *) {
     141                printf("handle\n");
     142        }
     143}
     144
Note: See TracChangeset for help on using the changeset viewer.