Ignore:
Timestamp:
Jun 21, 2023, 9:45:08 PM (10 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
6065281f
Parents:
2de175ce
Message:

change printf to sout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/interact.cfa

    r2de175ce r3bf9d10  
    11// Testing Interactions Between Termination and Resumption
    22
     3#include <fstream.hfa>
    34#include "except-io.hfa"
    45
     
    1415                throwResume (star){&star_vt};
    1516        } catch (star *) {
    16                 printf("caught as termination\n");
     17                sout | "caught as termination";
    1718        }
    1819        // Variant of the above to check timing.
     
    2122                throwResume (star){&star_vt};
    2223        } catch (star *) {
    23                 printf("caught as termination\n");
     24                sout | "caught as termination";
    2425        } catchResume (star *) {
    25                 printf("intermediate rethrow\n");
     26                sout | "intermediate rethrow";
    2627                throwResume;
    2728        }
    28         printf("\n");
     29        sout | nl;
    2930
    3031        // Resume does not catch terminate.
     
    3334                        throw (star){&star_vt};
    3435                } catchResume (star *) {
    35                         printf("resume catch on terminate\n");
     36                        sout | "resume catch on terminate";
    3637                }
    3738        } catchResume (star *) {
    38                 printf("resume catch on terminate\n");
     39                sout | "resume catch on terminate";
    3940        } catch (star *) {
    40                 printf("terminate catch on terminate\n");
     41                sout | "terminate catch on terminate";
    4142        }
    42         printf("\n");
     43        sout | nl;
    4344
    4445        // Terminate does not catch resume.
     
    4748                        throwResume (star){&star_vt};
    4849                } catch (star *) {
    49                         printf("terminate catch on resume\n");
     50                        sout | "terminate catch on resume";
    5051                }
    5152        } catch (star *) {
    52                 printf("terminate catch on resume\n");
     53                sout | "terminate catch on resume";
    5354        } catchResume (star *) {
    54                 printf("resume catch on resume\n");
     55                sout | "resume catch on resume";
    5556        }
    56         printf("\n");
     57        sout | nl;
    5758
    5859        // Resume a termination exception.
     
    6263                                throw (star){&star_vt};
    6364                        } catchResume (star *) {
    64                                 printf("inner resume catch (error)\n");
     65                                sout | "inner resume catch (error)";
    6566                        }
    6667                } catch (star * error) {
    67                         printf("termination catch, will resume\n");
     68                        sout | "termination catch, will resume";
    6869                        throwResume *error;
    6970                }
    7071        } catchResume (star *) {
    71                 printf("outer resume catch\n");
     72                sout | "outer resume catch";
    7273        }
    73         printf("\n");
     74        sout | nl;
    7475
    7576        // Terminate a resumption exception.
     
    7980                                throwResume (star){&star_vt};
    8081                        } catch (star *) {
    81                                 printf("inner termination catch\n");
     82                                sout | "inner termination catch";
    8283                        }
    8384                } catchResume (star * error) {
    84                         printf("resumption catch, will terminate\n");
     85                        sout | "resumption catch, will terminate";
    8586                        throw *error;
    8687                }
    8788        } catch (star *) {
    88                 printf("outer terminate catch (error)\n");
     89                sout | "outer terminate catch (error)";
    8990        }
    90         printf("\n");
     91        sout | nl;
    9192
    9293        // Unwinding a resumption catch does not break the system.
     
    9596                        try {
    9697                                try {
    97                                         printf("throwing resume moon\n");
     98                                        sout | "throwing resume moon";
    9899                                        throwResume (moon){&moon_vt};
    99100                                } catch (star *) {
    100                                         printf("termination catch\n");
     101                                        sout | "termination catch";
    101102                                }
    102                                 printf("throwing resume star\n");
     103                                sout | "throwing resume star";
    103104                                throwResume (star){&star_vt};
    104105                        } catchResume (star *) {
    105                                 printf("resumption star catch\n");
     106                                sout | "resumption star catch";
    106107                        }
    107108                } catchResume (moon *) {
    108                         printf("resumption moon catch, will terminate\n");
     109                        sout | "resumption moon catch, will terminate";
    109110                        throw (star){&star_vt};
    110111                }
    111112        } catchResume (star *) {
    112                 printf("outermost catch (error)\n");
     113                sout | "outermost catch (error)";
    113114        }
    114115}
Note: See TracChangeset for help on using the changeset viewer.