Ignore:
Timestamp:
Aug 17, 2017, 4:13:42 PM (8 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8f6dfe7
Parents:
21f0aa8
Message:

Updated exception tests to exception structures. Should be re-orginized still.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/except-1.c

    r21f0aa8 re9145a3  
    55#include <stdio.h>
    66
     7#include "except-mac.h"
     8TRIVIAL_EXCEPTION(yin)
     9TRIVIAL_EXCEPTION(yang)
     10
    711int main()
    812{
    913        try {
    10                 throw 3;
     14                yin a;
     15                THROW(&a);
    1116        }
    12         catch( 3 ) {
     17        catch( yin * err ) {
    1318                printf("First Caught\n");
    1419                try {
    15                         throw 4;
     20                        yang b;
     21                        THROW(&b);
    1622                }
    17                 catch( 4 ) {
     23                catch( yang * err ) {
    1824                        printf("Both Caught\n");
    1925                }
     
    2329        try {
    2430                try {
    25                         throw 2;
     31                        yang c;
     32                        THROW(&c);
    2633                }
    27                 catch( 2 ) {
     34                catch( yang * err ) {
    2835                        printf("First Catch and rethrow\n");
    2936                        throw;
    3037                }
    3138        }
    32         catch( 2 ) {
     39        catch( yang * err ) {
    3340                printf("Second Catch\n");
    3441        }
     
    3744        try {
    3845                try {
    39                         throw 5;
     46                        yin d;
     47                        THROW(&d);
    4048                }
    41                 catch( 5 ) {
     49                catch( yin * err ) {
    4250                        printf("Throw before cleanup\n");
    43                         throw 6;
     51                        yang e;
     52                        THROW(&e);
    4453                }
    4554        }
    46         catch( 6 ) {
     55        catch( yang * err ) {
    4756                printf("Catch after cleanup\n");
    4857        }
     
    5160        try {
    5261                try {
    53                         throw 7;
     62                        yin f;
     63                        THROW(&f);
    5464                }
    55                 catch( 7 ) {
     65                catch( yin * err ) {
    5666                        printf("Caught initial throw.\n");
    5767                        try {
    58                                 throw 8;
     68                                yang g;
     69                                THROW(&g);
    5970                        }
    60                         catch( 8 ) {
     71                        catch( yang * err ) {
    6172                                printf("Caught intermediate throw.\n");
    6273                        }
     
    6475                }
    6576        }
    66         catch( 7 ) {
     77        catch( yin * err ) {
    6778                printf("Caught final throw.\n");
    6879        }
Note: See TracChangeset for help on using the changeset viewer.