Changeset 828 in openpam for trunk


Ignore:
Timestamp:
Oct 23, 2014, 8:25:08 AM (7 years ago)
Author:
Dag-Erling Smørgrav
Message:

Better tests for line continuation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/t_openpam_readword.c

    r791 r828  
    171171}
    172172
    173 T_FUNC(line_continuation_in_whitespace, "line continuation in whitespace")
    174 {
    175         struct t_file *tf;
    176         int ret;
    177 
    178         tf = t_fopen(NULL);
    179         t_fprintf(tf, " \\\n \n");
    180         t_frewind(tf);
    181         ret = orw_expect(tf, NULL, 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
    182         t_fclose(tf);
    183         return (ret);
    184 }
    185 
    186173T_FUNC(comment, "comment")
    187174{
     
    900887        t_frewind(tf);
    901888        ret = orw_expect(tf, "\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     889        t_fclose(tf);
     890        return (ret);
     891}
     892
     893
     894
     895/***************************************************************************
     896 * Line continuation
     897 */
     898
     899T_FUNC(line_continuation_within_whitespace, "line continuation within whitespace")
     900{
     901        struct t_file *tf;
     902        int ret;
     903
     904        tf = t_fopen(NULL);
     905        t_fprintf(tf, " \\\n \n");
     906        t_frewind(tf);
     907        ret = orw_expect(tf, NULL, 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     908        t_fclose(tf);
     909        return (ret);
     910}
     911
     912T_FUNC(line_continuation_before_whitespace, "line continuation before whitespace")
     913{
     914        struct t_file *tf;
     915        int ret;
     916
     917        tf = t_fopen(NULL);
     918        t_fprintf(tf, "xyzzy\\\n \n");
     919        t_frewind(tf);
     920        ret = orw_expect(tf, "xyzzy", 1 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
     921            orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     922        t_fclose(tf);
     923        return (ret);
     924}
     925
     926T_FUNC(line_continuation_after_whitespace, "line continuation after whitespace")
     927{
     928        struct t_file *tf;
     929        int ret;
     930
     931        tf = t_fopen(NULL);
     932        t_fprintf(tf, " \\\nxyzzy\n");
     933        t_frewind(tf);
     934        ret = orw_expect(tf, "xyzzy", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     935        t_fclose(tf);
     936        return (ret);
     937}
     938
     939T_FUNC(line_continuation_within_word, "line continuation within word")
     940{
     941        struct t_file *tf;
     942        int ret;
     943
     944        tf = t_fopen(NULL);
     945        t_fprintf(tf, "xyz\\\nzy\n");
     946        t_frewind(tf);
     947        ret = orw_expect(tf, "xyzzy", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
    902948        t_fclose(tf);
    903949        return (ret);
     
    916962        T(single_whitespace),
    917963        T(multiple_whitespace),
    918         T(line_continuation_in_whitespace),
    919964        T(comment),
    920965        T(whitespace_before_comment),
     
    9731018        T(escaped_double_quote_within_double_quotes),
    9741019
     1020        T(line_continuation_within_whitespace),
     1021        T(line_continuation_before_whitespace),
     1022        T(line_continuation_after_whitespace),
     1023        T(line_continuation_within_word),
     1024
    9751025        NULL
    9761026};
Note: See TracChangeset for help on using the changeset viewer.