Ignore:
Timestamp:
Jun 26, 2023, 10:51:47 AM (2 years ago)
Author:
caparson <caparson@…>
Branches:
master
Children:
917e1fd
Parents:
adc73a5 (diff), 1fbf481 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/defaults.cfa

    radc73a5 r48ec19a  
    11// Tests for providing new default operations.
    22
     3#include <fstream.hfa>
    34#include <string.h>
    45
     
    3536                throwResume (log_message){&log_vt, "Should be printed.\n"};
    3637        } catchResume (log_message * this) {
    37                 printf("%s", this->virtual_table->msg(this));
     38                sout | this->virtual_table->msg(this) | nonl;
    3839        }
    3940        // But we don't have to:
     
    4445exception jump {};
    4546void defaultTerminationHandler(jump &) {
    46         printf("jump default handler.\n");
     47        sout | "jump default handler.";
    4748}
    4849
     
    5354                throw (jump){&jump_vt};
    5455        } catch (jump * this) {
    55                 printf("jump catch handler.\n");
     56                sout | "jump catch handler.";
    5657        }
    5758        throw (jump){&jump_vt};
     
    7576                throw (first){&first_vt};
    7677        } catch (unhandled_exception * t) {
    77                 printf("Catch unhandled_exception.\n");
     78                sout | "Catch unhandled_exception.";
    7879        }
    7980}
     
    8485void cross_test(void) {
    8586        void defaultTerminationHandler(first &) {
    86                 printf("cross terminate default\n");
     87                sout | "cross terminate default";
    8788                throw (second){&second_vt};
    8889        }
    8990        void defaultResumptionHandler(first &) {
    90                 printf("cross resume default\n");
     91                sout | "cross resume default";
    9192                throwResume (second){&second_vt};
    9293        }
    9394        try {
    94                 printf("cross terminate throw\n");
     95                sout | "cross terminate throw";
    9596                throw (first){&first_vt};
    9697        } catch (second *) {
    97                 printf("cross terminate catch\n");
     98                sout | "cross terminate catch";
    9899        }
    99100        try {
    100                 printf("cross resume throw\n");
     101                sout | "cross resume throw";
    101102                throwResume (first){&first_vt};
    102103        } catchResume (second *) {
    103                 printf("cross resume catch\n");
     104                sout | "cross resume catch";
    104105        }
    105106}
Note: See TracChangeset for help on using the changeset viewer.