Changeset 13f5a70 for src/tests


Ignore:
Timestamp:
Mar 14, 2018, 11:29:40 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, with_gc
Children:
5f61546, 759f05f
Parents:
692afbb
Message:

add another test

Location:
src/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/fallthrough-ERROR.txt

    r692afbb r13f5a70  
    1 fallthrough.c:54:1 error: 'fallthrough' must be enclosed in a 'switch' or 'choose'
    2 fallthrough.c:56:1 error: 'fallthrough' must be enclosed in a 'switch' or 'choose'
    3 fallthrough.c:58:1 error: 'fallthrough' must be enclosed in a 'switch' or 'choose'
    4 fallthrough.c:65:1 error: 'fallthrough default' must be enclosed in a 'switch' or 'choose' control structure with a 'default' clause
    5 fallthrough.c:67:1 error: 'fallthrough' target must be a later case statement: common3
    6 fallthrough.c:75:1 error: 'fallthrough' target must be a later case statement: common4
    7 fallthrough.c:77:1 error: 'fallthrough default' must precede the 'default' clause
     1fallthrough.c:87:1 error: 'fallthrough' must be enclosed in a 'switch' or 'choose'
     2fallthrough.c:89:1 error: 'fallthrough' must be enclosed in a 'switch' or 'choose'
     3fallthrough.c:91:1 error: 'fallthrough' must be enclosed in a 'switch' or 'choose'
     4fallthrough.c:98:1 error: 'fallthrough default' must be enclosed in a 'switch' or 'choose' control structure with a 'default' clause
     5fallthrough.c:100:1 error: 'fallthrough' target must be a later case statement: common3
     6fallthrough.c:108:1 error: 'fallthrough' target must be a later case statement: common4
     7fallthrough.c:110:1 error: 'fallthrough default' must precede the 'default' clause
  • src/tests/.expect/fallthrough.txt

    r692afbb r13f5a70  
    33case 3
    44default
     5
     6case 1
     7case 1
     80
     91
     102
     11common
     12default
     13
    514case 5
    615common2
     16
     17case 5
     18check
     19common
     20default
  • src/tests/fallthrough.c

    r692afbb r13f5a70  
    99// Author           : Rob Schluntz
    1010// Created On       : Wed Mar 14 10:06:25 2018
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Mar 14 10:32:12 2018
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Mar 14 22:45:13 2018
     13// Update Count     : 13
    1414//
    1515
     
    3131                common1:
    3232                        printf("common1\n");
    33                 /* break */
     33                // break
    3434                case 4:
    3535                        printf("case 4\n");
     
    4444                common2:
    4545                        printf("common2\n");
    46                 /* break */
     46                // break
    4747                default:
    4848                        printf("default\n");
    4949                        fallthru;
    5050        }
     51
     52        printf("\n");
     53
     54        switch ( choice ) {
     55          case 1:
     56                printf("case 1\n");
     57                switch ( choice ) {
     58                  case 1:
     59                        printf("case 1\n");
     60                        for ( int i = 0; i < 4; i += 1 ) {
     61                                printf("%d\n", i);
     62                                if ( i == 2 ) fallthru common;
     63                        } // for
     64                } // switch
     65                break;
     66          case 5:
     67                printf("case 5\n");
     68                if ( choice == 5 ) {
     69                        if ( choice != 5 ) {
     70                                printf("error\n");
     71                        } else {
     72                                printf("check\n");
     73                                fallthru common;
     74                        } // if
     75                } // if
     76          common:
     77                printf( "common\n" );
     78                fallthru;
     79                break;
     80          default:
     81                printf( "default\n" );
     82                fallthru;
     83        } // switch
    5184
    5285#if ERR1
     
    82115int main() {
    83116        test(1);
     117        printf("\n");
    84118        test(5);
    85119}
     
    87121// Local Variables: //
    88122// tab-width: 4 //
    89 // compile-command: "cfa dtor-early-exit" //
     123// compile-command: "cfa fallthrough.c" //
    90124// End: //
Note: See TracChangeset for help on using the changeset viewer.