util: allow unbalanced double quote in EXTRACT_QUOTES|EXTRACT_RELAX mode

extract_first_word understands "\'string" but doesn't understand "\"string"
fixed this inconsistency.
This commit is contained in:
Evgeny Vereshchagin
2015-10-22 00:37:32 +00:00
parent 2dcc3c69a1
commit 9e44f56b4e
2 changed files with 10 additions and 2 deletions
+6
View File
@@ -1639,6 +1639,12 @@ static void test_extract_first_word(void) {
free(t);
assert_se(isempty(p));
p = original = "\"fooo";
assert_se(extract_first_word(&p, &t, NULL, EXTRACT_QUOTES|EXTRACT_RELAX) > 0);
assert_se(streq(t, "fooo"));
free(t);
assert_se(isempty(p));
p = original = "yay\'foo\'bar";
assert_se(extract_first_word(&p, &t, NULL, 0) > 0);
assert_se(streq(t, "yay\'foo\'bar"));