[tor-commits] [tor/master] Improve config parser escaped content tests
nickm at torproject.org
nickm at torproject.org
Fri Mar 9 16:30:59 UTC 2012
commit 72d455b5eb00b2d87228c05ae6e818415f125cf6
Author: Esteban Manchado Velázquez <emanchado at demiurgo.org>
Date: Fri Feb 3 21:05:17 2012 +0100
Improve config parser escaped content tests
---
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 86c650e..b8c0544 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);
More information about the tor-commits
mailing list