diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2010-09-23 22:39:58 +0200 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2010-09-23 22:46:13 +0200 |
commit | 1d29ad891e848dcb48120331e0d2f78bd6777746 (patch) | |
tree | f97914ea5e928cd507e3d03e844e71c4b9970d73 | |
parent | 1dab6cf4cbb35e27dd1d13f7deeb3e25f7dfcd5c (diff) | |
download | tor-1d29ad891e848dcb48120331e0d2f78bd6777746.tar.gz tor-1d29ad891e848dcb48120331e0d2f78bd6777746.zip |
Add new torrc line continuation unit tests
We want to make sure that we don't break old torrc files that might have
used something like this made-up example:
ContactInfo UberUser <uber@user.com> # /// Fake email! \\\
Log info file /home/nick.mathewson/projects/tor-info.log
And we also want to support the following style of writing your torrc:
ExcludeNodes \
# Node1337 is run by the Bavarian Illuminati
Node1337, \
# The operator of Node99 looked at me funny
Node99
The code already handles both cases, but the unit test should help prove
it.
-rw-r--r-- | src/test/test_util.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 49823fde70..d90927b35f 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -105,6 +105,10 @@ test_util_config_line(void) "k11 \\\ncontinuation at the start\n" "k12 line with a\\\n#comment\n embedded\n" "k13\\\ncontinuation at the very start\n" + "k14 a line that has a comment and # ends with a slash \\\n" + "k15 this should be the next new line\n" + "k16 a line that has a comment and # ends without a slash \n" + "k17 this should be the next new line\n" , sizeof(buf)); str = buf; @@ -192,6 +196,26 @@ test_util_config_line(void) test_streq(v, "continuation at the very start"); tor_free(k); tor_free(v); + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k14"); + test_streq(v, "a line that has a comment and" ); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k15"); + test_streq(v, "this should be the next new line"); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k16"); + test_streq(v, "a line that has a comment and" ); + tor_free(k); tor_free(v); + + str = parse_config_line_from_str(str, &k, &v); + test_streq(k, "k17"); + test_streq(v, "this should be the next new line"); + tor_free(k); tor_free(v); + test_streq(str, ""); done: |