Changeset 633 in openpam


Ignore:
Timestamp:
Mar 3, 2013, 10:57:21 PM (8 years ago)
Author:
Dag-Erling Smørgrav
Message:

Add test cases that mix quoted and unquoted text.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/t_openpam_readword.c

    r619 r633  
    563563
    564564/***************************************************************************
     565 * Combinations of quoted and unquoted text
     566 */
     567
     568T_FUNC(single_quote_before_word, "single quote before word")
     569{
     570        struct t_file *tf;
     571        int ret;
     572
     573        tf = t_fopen(NULL);
     574        t_fprintf(tf, "'hello 'world\n");
     575        t_frewind(tf);
     576        ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     577        t_fclose(tf);
     578        return (ret);
     579}
     580
     581T_FUNC(double_quote_before_word, "double quote before word")
     582{
     583        struct t_file *tf;
     584        int ret;
     585
     586        tf = t_fopen(NULL);
     587        t_fprintf(tf, "\"hello \"world\n");
     588        t_frewind(tf);
     589        ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     590        t_fclose(tf);
     591        return (ret);
     592}
     593
     594T_FUNC(single_quote_within_word, "single quote within word")
     595{
     596        struct t_file *tf;
     597        int ret;
     598
     599        tf = t_fopen(NULL);
     600        t_fprintf(tf, "hello' 'world\n");
     601        t_frewind(tf);
     602        ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     603        t_fclose(tf);
     604        return (ret);
     605}
     606
     607T_FUNC(double_quote_within_word, "double quote within word")
     608{
     609        struct t_file *tf;
     610        int ret;
     611
     612        tf = t_fopen(NULL);
     613        t_fprintf(tf, "hello\" \"world\n");
     614        t_frewind(tf);
     615        ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     616        t_fclose(tf);
     617        return (ret);
     618}
     619
     620T_FUNC(single_quote_after_word, "single quote after word")
     621{
     622        struct t_file *tf;
     623        int ret;
     624
     625        tf = t_fopen(NULL);
     626        t_fprintf(tf, "hello' world'\n");
     627        t_frewind(tf);
     628        ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     629        t_fclose(tf);
     630        return (ret);
     631}
     632
     633T_FUNC(double_quote_after_word, "double quote after word")
     634{
     635        struct t_file *tf;
     636        int ret;
     637
     638        tf = t_fopen(NULL);
     639        t_fprintf(tf, "hello\" world\"\n");
     640        t_frewind(tf);
     641        ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
     642        t_fclose(tf);
     643        return (ret);
     644}
     645
     646
     647
     648/***************************************************************************
    565649 * Combinations of escape and quotes
    566650 */
     
    782866        T(single_quoted_words),
    783867        T(double_quoted_words),
     868
     869        T(single_quote_before_word),
     870        T(double_quote_before_word),
     871        T(single_quote_within_word),
     872        T(double_quote_within_word),
     873        T(single_quote_after_word),
     874        T(double_quote_after_word),
    784875
    785876        T(escaped_single_quote),
Note: See TracChangeset for help on using the changeset viewer.