diff options
author | Esteban Manchado Velázquez <emanchado@demiurgo.org> | 2012-02-03 21:05:17 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-03-08 20:49:17 -0500 |
commit | 72d455b5eb00b2d87228c05ae6e818415f125cf6 (patch) | |
tree | 99ce1a144eb9d0aeddb318eef37b91941ca74354 | |
parent | 4d9dda9bb9129fa7996c077a2f98c65e6b123178 (diff) | |
download | tor-72d455b5eb00b2d87228c05ae6e818415f125cf6.tar tor-72d455b5eb00b2d87228c05ae6e818415f125cf6.tar.gz |
Improve config parser escaped content tests
-rw-r--r-- | src/test/test_util.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 86c650eea..b8c0544c3 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -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); |