diff options
author | Daniel Mack <github@zonque.org> | 2015-10-07 15:32:42 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-10-07 15:32:42 +0200 |
commit | 79bec997c911be7c903db9f7e5d07ab2cd303ed7 (patch) | |
tree | 1e6e62138a8920a3210b8063157612b484efbea6 /src/test | |
parent | f74431288aec78ffdd05be9a519eab3dbe1c4f81 (diff) | |
parent | e287086b8aa2558356af225a12d9bfea8e7d61ca (diff) |
Merge pull request #1484 from poettering/ask-pass-kernel-keyring
cache harddisk passwords in the kernel keyring
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-strv.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 64801f8e01..623c926521 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -341,11 +341,11 @@ static void test_strv_extend_strv(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL; a = strv_new("abc", "def", "ghi", NULL); - b = strv_new("jkl", "mno", "pqr", NULL); + b = strv_new("jkl", "mno", "abc", "pqr", NULL); assert_se(a); assert_se(b); - assert_se(strv_extend_strv(&a, b) >= 0); + assert_se(strv_extend_strv(&a, b, true) == 3); assert_se(streq(a[0], "abc")); assert_se(streq(a[1], "def")); @@ -618,6 +618,28 @@ static void test_strv_extend_n(void) { assert_se(v[1] == NULL); } +static void test_strv_make_nulstr_one(char **l) { + _cleanup_free_ char *b = NULL, *c = NULL; + _cleanup_strv_free_ char **q = NULL; + size_t n, m; + + assert_se(strv_make_nulstr(l, &b, &n) >= 0); + assert_se(q = strv_parse_nulstr(b, n)); + assert_se(strv_equal(l, q)); + + assert_se(strv_make_nulstr(q, &c, &m) >= 0); + assert_se(m == n); + assert_se(memcmp(b, c, m) == 0); +} + +static void test_strv_make_nulstr(void) { + test_strv_make_nulstr_one(NULL); + test_strv_make_nulstr_one(STRV_MAKE(NULL)); + test_strv_make_nulstr_one(STRV_MAKE("foo")); + test_strv_make_nulstr_one(STRV_MAKE("foo", "bar")); + test_strv_make_nulstr_one(STRV_MAKE("foo", "bar", "quuux")); +} + int main(int argc, char *argv[]) { test_specifier_printf(); test_strv_foreach(); @@ -678,6 +700,7 @@ int main(int argc, char *argv[]) { test_strv_shell_escape(); test_strv_skip(); test_strv_extend_n(); + test_strv_make_nulstr(); return 0; } |