[tor-commits] [torsocks/master] Tests: add one for utils_tokenize_ignore_comments

dgoulet at torproject.org dgoulet at torproject.org
Fri Apr 4 22:40:27 UTC 2014


commit ff98d5277ecccd3cbc425c572f75dc987bd405e2
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Thu Feb 20 13:57:14 2014 +0000

    Tests: add one for utils_tokenize_ignore_comments
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 tests/unit/test_utils.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/unit/test_utils.c b/tests/unit/test_utils.c
index 8efa19a..a115db1 100644
--- a/tests/unit/test_utils.c
+++ b/tests/unit/test_utils.c
@@ -24,7 +24,7 @@
 
 #include <tap/tap.h>
 
-#define NUM_TESTS 30
+#define NUM_TESTS 31
 
 static void test_is_address_ipv4(void)
 {
@@ -156,6 +156,14 @@ static void test_utils_tokenize_ignore_comments(void)
 	diag("Utils tokenize line test");
 
 	helper_reset_tokens(tokens);
+	strcpy(line, "a\tb");
+	nb_token = utils_tokenize_ignore_comments(line, sizeof(tokens), tokens);
+	ok(nb_token == 2 &&
+		(0 == strcmp(tokens[0], "a")) &&
+		(0 == strcmp(tokens[1], "b")),
+		"Returns 2 tokens");
+
+	helper_reset_tokens(tokens);
 	strcpy(line, "foo bar");
 	nb_token = utils_tokenize_ignore_comments(line, sizeof(tokens), tokens);
 	ok(nb_token == 2 &&





More information about the tor-commits mailing list