summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-12-16 21:10:51 +0000
committerNick Mathewson <nickm@torproject.org>2004-12-16 21:10:51 +0000
commitbbc10c2ea12b836497d3ef41fc434b50108b70f1 (patch)
tree53b685569045209495dfba7b1f81f7b69c831402 /src/or/test.c
parenta3922d0bdcc06a22131d26a4258590338b8cea12 (diff)
downloadtor-bbc10c2ea12b836497d3ef41fc434b50108b70f1.tar.gz
tor-bbc10c2ea12b836497d3ef41fc434b50108b70f1.zip
Make split(..., NULL) split on horizontal space; fix bug with tabs in config file.
svn:r3155
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 4cbdf1bca6..817e571e92 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -642,6 +642,22 @@ test_util(void) {
SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp));
smartlist_clear(sl);
+ smartlist_split_string(sl, " ab\tc \td ef ", NULL,
+ SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
+ test_eq(4, smartlist_len(sl));
+ test_streq("ab", smartlist_get(sl,0));
+ test_streq("c", smartlist_get(sl,1));
+ test_streq("d", smartlist_get(sl,2));
+ test_streq("ef", smartlist_get(sl,3));
+ smartlist_split_string(sl, "ghi\tj", NULL,
+ SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
+ test_eq(6, smartlist_len(sl));
+ test_streq("ghi", smartlist_get(sl,4));
+ test_streq("j", smartlist_get(sl,5));
+
+ SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp));
+ smartlist_clear(sl);
+
smartlist_split_string(sl, " z <> zhasd <> <> bnud<> ", "<>", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
test_eq(3, smartlist_len(sl));
test_streq("z", smartlist_get(sl, 0));