[systemd-devel] [PATCH 1/3] test-strv.c: added strv_split
Daniel Buch
boogiewasthere at gmail.com
Thu Oct 31 10:03:08 CET 2013
---
src/test/test-strv.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index f32d02e..e96200e 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -156,6 +156,21 @@ static void test_strv_quote_unquote(const char* const *split, const char *quoted
}
}
+static void test_strv_split(void) {
+ char **s;
+ unsigned i = 0;
+ _cleanup_strv_free_ char **l = NULL;
+ const char str[] = "one,two,three";
+
+ l = strv_split(str, ",");
+
+ assert(l);
+
+ STRV_FOREACH(s, l) {
+ assert_se(streq(*s, input_table_multiple[i++]));
+ }
+}
+
static void test_strv_split_nulstr(void) {
_cleanup_strv_free_ char **l = NULL;
const char nulstr[] = "str0\0str1\0str2\0str3\0";
@@ -359,6 +374,7 @@ int main(int argc, char *argv[]) {
test_strv_quote_unquote(input_table_quotes, QUOTES_STRING);
test_strv_quote_unquote(input_table_spaces, SPACES_STRING);
+ test_strv_split();
test_strv_split_nulstr();
test_strv_parse_nulstr();
test_strv_overlap();
--
1.8.4.2
More information about the systemd-devel
mailing list