aboutsummaryrefslogtreecommitdiff
path: root/test/test_split.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_split.c')
-rw-r--r--test/test_split.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_split.c b/test/test_split.c
index 7b19caa..fc7513b 100644
--- a/test/test_split.c
+++ b/test/test_split.c
@@ -39,3 +39,21 @@ test_split2()
log("OK\n");
}
+
+void
+test_split3()
+{
+ log("Running...");
+
+ char *str = "\nSTR_1\nSTR_2\n";
+ int size;
+ char **tokens = strsplit(str, '\n', &size);
+
+ assert(size == 4);
+ assert(strlen(tokens[0]) == 0);
+ assert(strncmp("STR_1", tokens[1], 5) == 0);
+ assert(strncmp("STR_2", tokens[2], 5) == 0);
+ assert(strlen(tokens[3]) == 0);
+
+ log("OK\n");
+}