diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-15 14:08:28 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-15 14:08:28 +0100 |
commit | 4d5d9d001105507ee40ff56f0456053c2c7ed6d3 (patch) | |
tree | 03c470a4c31d1d6f9f041863a94ea1452dbc9b88 /src/test/test-strv.c | |
parent | 3aa3d5d412d9d7f548c08b2d060331437ed7d514 (diff) | |
parent | 7f6e804332f50dbd52afe04f5c3ce9db1072c98b (diff) |
Merge pull request #2596 from keszybz/move-activate-to-bin
Move activate to bin, extend --fdnames functionality
Diffstat (limited to 'src/test/test-strv.c')
-rw-r--r-- | src/test/test-strv.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 2b2f76cc7f..ef451c6abf 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -70,6 +70,18 @@ static const char* const input_table_none[] = { NULL, }; +static const char* const input_table_two_empties[] = { + "", + "", + NULL, +}; + +static const char* const input_table_one_empty[] = { + "", + NULL, +}; + + static const char* const input_table_quotes[] = { "\"", "'", @@ -130,7 +142,7 @@ static void test_strv_find_startswith(void) { } static void test_strv_join(void) { - _cleanup_free_ char *p = NULL, *q = NULL, *r = NULL, *s = NULL, *t = NULL; + _cleanup_free_ char *p = NULL, *q = NULL, *r = NULL, *s = NULL, *t = NULL, *v = NULL, *w = NULL; p = strv_join((char **)input_table_multiple, ", "); assert_se(p); @@ -151,6 +163,14 @@ static void test_strv_join(void) { t = strv_join((char **)input_table_none, ", "); assert_se(t); assert_se(streq(t, "")); + + v = strv_join((char **)input_table_two_empties, ", "); + assert_se(v); + assert_se(streq(v, ", ")); + + w = strv_join((char **)input_table_one_empty, ", "); + assert_se(w); + assert_se(streq(w, "")); } static void test_strv_quote_unquote(const char* const *split, const char *quoted) { @@ -653,6 +673,8 @@ int main(int argc, char *argv[]) { test_strv_quote_unquote(input_table_multiple, "\"one\" \"two\" \"three\""); test_strv_quote_unquote(input_table_one, "\"one\""); test_strv_quote_unquote(input_table_none, ""); + test_strv_quote_unquote(input_table_one_empty, "\"\""); + test_strv_quote_unquote(input_table_two_empties, "\"\" \"\""); test_strv_quote_unquote(input_table_quotes, QUOTES_STRING); test_strv_quote_unquote(input_table_spaces, SPACES_STRING); |