|
@@ -7,9 +7,10 @@
|
|
|
|
|
|
int testc_faux_str_nextword(void)
|
|
|
{
|
|
|
- const char* line = "asd\"\\\"\"mmm `ll\"l\\p\\\\m```j`j`` ```kk``pp``` ll\\ l \"aaa\"bbb`ccc```ddd``eee ``lk\\\"";
|
|
|
+ const char* line = "asd\"\\\"\"mmm \"``\" `ll\"l\\p\\\\m```j`j`` ```kk``pp``` ll\\ l \"aaa\"bbb`ccc```ddd``eee ``lk\\\"";
|
|
|
const char* etalon[] = {
|
|
|
"asd\"mmm",
|
|
|
+ "``",
|
|
|
"ll\"l\\p\\\\mj`j",
|
|
|
"kk``pp",
|
|
|
"ll l",
|
|
@@ -20,6 +21,7 @@ int testc_faux_str_nextword(void)
|
|
|
int retval = 0;
|
|
|
int i = 0;
|
|
|
const char *saveptr = line;
|
|
|
+ bool_t closed_quotes = BOOL_FALSE;
|
|
|
|
|
|
printf("Line : [%s]\n", line);
|
|
|
|
|
@@ -27,7 +29,7 @@ int testc_faux_str_nextword(void)
|
|
|
int r = -1;
|
|
|
char *res = NULL;
|
|
|
printf("Etalon %d : [%s]\n", i, etalon[i]);
|
|
|
- res = faux_str_nextword(saveptr, &saveptr, "`");
|
|
|
+ res = faux_str_nextword(saveptr, &saveptr, "`", &closed_quotes);
|
|
|
if (!res) {
|
|
|
printf("The faux_str_nextword() return value is NULL\n");
|
|
|
break;
|
|
@@ -41,6 +43,13 @@ int testc_faux_str_nextword(void)
|
|
|
}
|
|
|
faux_str_free(res);
|
|
|
}
|
|
|
+
|
|
|
+ if (closed_quotes) {
|
|
|
+ printf("Closed quotes flag is wrong\n");
|
|
|
+ retval = -1;
|
|
|
+ } else {
|
|
|
+ printf("Really unclosed quotes\n");
|
|
|
+ }
|
|
|
|
|
|
return retval;
|
|
|
}
|