Add test cases that mix quoted and unquoted text.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@633 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
1a070e2544
commit
b21442245a
|
@ -555,6 +555,89 @@ T_FUNC(double_quoted_words, "double-quoted words")
|
|||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Combinations of quoted and unquoted text
|
||||
*/
|
||||
|
||||
T_FUNC(single_quote_before_word, "single quote before word")
|
||||
{
|
||||
struct t_file *tf;
|
||||
int ret;
|
||||
|
||||
tf = t_fopen(NULL);
|
||||
t_fprintf(tf, "'hello 'world\n");
|
||||
t_frewind(tf);
|
||||
ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
|
||||
t_fclose(tf);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
T_FUNC(double_quote_before_word, "double quote before word")
|
||||
{
|
||||
struct t_file *tf;
|
||||
int ret;
|
||||
|
||||
tf = t_fopen(NULL);
|
||||
t_fprintf(tf, "\"hello \"world\n");
|
||||
t_frewind(tf);
|
||||
ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
|
||||
t_fclose(tf);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
T_FUNC(single_quote_within_word, "single quote within word")
|
||||
{
|
||||
struct t_file *tf;
|
||||
int ret;
|
||||
|
||||
tf = t_fopen(NULL);
|
||||
t_fprintf(tf, "hello' 'world\n");
|
||||
t_frewind(tf);
|
||||
ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
|
||||
t_fclose(tf);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
T_FUNC(double_quote_within_word, "double quote within word")
|
||||
{
|
||||
struct t_file *tf;
|
||||
int ret;
|
||||
|
||||
tf = t_fopen(NULL);
|
||||
t_fprintf(tf, "hello\" \"world\n");
|
||||
t_frewind(tf);
|
||||
ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
|
||||
t_fclose(tf);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
T_FUNC(single_quote_after_word, "single quote after word")
|
||||
{
|
||||
struct t_file *tf;
|
||||
int ret;
|
||||
|
||||
tf = t_fopen(NULL);
|
||||
t_fprintf(tf, "hello' world'\n");
|
||||
t_frewind(tf);
|
||||
ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
|
||||
t_fclose(tf);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
T_FUNC(double_quote_after_word, "double quote after word")
|
||||
{
|
||||
struct t_file *tf;
|
||||
int ret;
|
||||
|
||||
tf = t_fopen(NULL);
|
||||
t_fprintf(tf, "hello\" world\"\n");
|
||||
t_frewind(tf);
|
||||
ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
|
||||
t_fclose(tf);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Combinations of escape and quotes
|
||||
|
@ -776,6 +859,13 @@ const struct t_test *t_plan[] = {
|
|||
T(single_quoted_words),
|
||||
T(double_quoted_words),
|
||||
|
||||
T(single_quote_before_word),
|
||||
T(double_quote_before_word),
|
||||
T(single_quote_within_word),
|
||||
T(double_quote_within_word),
|
||||
T(single_quote_after_word),
|
||||
T(double_quote_after_word),
|
||||
|
||||
T(escaped_single_quote),
|
||||
T(escaped_double_quote),
|
||||
T(escaped_whitespace_within_single_quotes),
|
||||
|
|
Loading…
Reference in New Issue