mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Improve config parser escaped content tests
This commit is contained in:
parent
4d9dda9bb9
commit
72d455b5eb
@ -315,8 +315,10 @@ test_util_config_line_escaped_content(void)
|
||||
"Newline \"\\n\"\n"
|
||||
"Tab \"\\t\"\n"
|
||||
"CarriageReturn \"\\r\"\n"
|
||||
"Quote \"\\\"\"\n"
|
||||
"DoubleQuote \"\\\"\"\n"
|
||||
"SimpleQuote \"\\'\"\n"
|
||||
"Backslash \"\\\\\"\n"
|
||||
"Mix \"This is a \\\"star\\\":\\t\\'\\x2a\\'\\nAnd second line\"\n"
|
||||
, sizeof(buf1));
|
||||
|
||||
strlcpy(buf2, "BrokenEscapedContent \"\\a\"\n"
|
||||
@ -366,15 +368,25 @@ test_util_config_line_escaped_content(void)
|
||||
tor_free(k); tor_free(v);
|
||||
|
||||
str = parse_config_line_from_str(str, &k, &v);
|
||||
test_streq(k, "Quote");
|
||||
test_streq(k, "DoubleQuote");
|
||||
test_streq(v, "\"");
|
||||
tor_free(k); tor_free(v);
|
||||
|
||||
str = parse_config_line_from_str(str, &k, &v);
|
||||
test_streq(k, "SimpleQuote");
|
||||
test_streq(v, "'");
|
||||
tor_free(k); tor_free(v);
|
||||
|
||||
str = parse_config_line_from_str(str, &k, &v);
|
||||
test_streq(k, "Backslash");
|
||||
test_streq(v, "\\");
|
||||
tor_free(k); tor_free(v);
|
||||
|
||||
str = parse_config_line_from_str(str, &k, &v);
|
||||
test_streq(k, "Mix");
|
||||
test_streq(v, "This is a \"star\":\t'*'\nAnd second line");
|
||||
tor_free(k); tor_free(v);
|
||||
|
||||
str = buf2;
|
||||
|
||||
str = parse_config_line_from_str(str, &k, &v);
|
||||
|
Loading…
Reference in New Issue
Block a user