diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-env-util.c | 17 | ||||
-rw-r--r-- | src/test/test-exec-util.c | 3 | ||||
-rw-r--r-- | src/test/test-nss.c | 7 | ||||
-rw-r--r-- | src/test/test-path-util.c | 2 | ||||
-rw-r--r-- | src/test/test-serialize.c | 5 | ||||
-rw-r--r-- | src/test/test-sleep.c | 16 | ||||
-rw-r--r-- | src/test/test-strv.c | 53 |
7 files changed, 50 insertions, 53 deletions
diff --git a/src/test/test-env-util.c b/src/test/test-env-util.c index ee9734fd66..4c33c7c13c 100644 --- a/src/test/test-env-util.c +++ b/src/test/test-env-util.c @@ -15,13 +15,13 @@ static void test_strv_env_delete(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL, **c = NULL, **d = NULL; - a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF", NULL); + a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF"); assert_se(a); - b = strv_new("PIEP", "FOO", NULL); + b = strv_new("PIEP", "FOO"); assert_se(b); - c = strv_new("SCHLUMPF", NULL); + c = strv_new("SCHLUMPF"); assert_se(c); d = strv_env_delete(a, 2, b, c); @@ -45,7 +45,7 @@ static void test_strv_env_get(void) { static void test_strv_env_unset(void) { _cleanup_strv_free_ char **l = NULL; - l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL); + l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES"); assert_se(l); assert_se(strv_env_unset(l, "SCHLUMPF") == l); @@ -58,7 +58,7 @@ static void test_strv_env_unset(void) { static void test_strv_env_set(void) { _cleanup_strv_free_ char **l = NULL, **r = NULL; - l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL); + l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES"); assert_se(l); r = strv_env_set(l, "WALDO=WALDO"); @@ -74,10 +74,10 @@ static void test_strv_env_set(void) { static void test_strv_env_merge(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL, **r = NULL; - a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF", NULL); + a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF"); assert_se(a); - b = strv_new("FOO=KKK", "FOO=", "PIEP=", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL); + b = strv_new("FOO=KKK", "FOO=", "PIEP=", "SCHLUMPF=SMURFF", "NANANANA=YES"); assert_se(b); r = strv_env_merge(2, a, b); @@ -250,8 +250,7 @@ static void test_env_clean(void) { "xyz\n=xyz", "xyz=xyz\n", "another=one", - "another=final one", - NULL); + "another=final one"); assert_se(e); assert_se(!strv_env_is_valid(e)); assert_se(strv_env_clean(e) == e); diff --git a/src/test/test-exec-util.c b/src/test/test-exec-util.c index e74b95231d..21a4538d74 100644 --- a/src/test/test-exec-util.c +++ b/src/test/test-exec-util.c @@ -346,7 +346,8 @@ static void test_environment_gathering(void) { /* now retest with "default" path passed in, as created by * manager_default_environment */ env = strv_free(env); - env = strv_new("PATH=" DEFAULT_PATH, NULL); + env = strv_new("PATH=" DEFAULT_PATH); + assert_se(env); r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, env); assert_se(r >= 0); diff --git a/src/test/test-nss.c b/src/test/test-nss.c index d9440682d2..20aa6cf01f 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -424,7 +424,7 @@ static int parse_argv(int argc, char **argv, size_t n_allocated = 0; if (argc > 1) - modules = strv_new(argv[1], NULL); + modules = strv_new(argv[1]); else modules = strv_new( #if ENABLE_NSS_MYHOSTNAME @@ -436,8 +436,7 @@ static int parse_argv(int argc, char **argv, #if ENABLE_NSS_MYMACHINES "mymachines", #endif - "dns", - NULL); + "dns"); if (!modules) return -ENOMEM; @@ -468,7 +467,7 @@ static int parse_argv(int argc, char **argv, if (!hostname) return -ENOMEM; - names = strv_new("localhost", "_gateway", "foo_no_such_host", hostname, NULL); + names = strv_new("localhost", "_gateway", "foo_no_such_host", hostname); if (!names) return -ENOMEM; diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 8b9686d50b..fd5f598701 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -293,7 +293,7 @@ static void test_strv_resolve(void) { assert_se(mkdtemp(tmp_dir) != NULL); - search_dirs = strv_new("/dir1", "/dir2", "/dir3", NULL); + search_dirs = strv_new("/dir1", "/dir2", "/dir3"); assert_se(search_dirs); STRV_FOREACH(d, search_dirs) { char *p = strappend(tmp_dir, *d); diff --git a/src/test/test-serialize.c b/src/test/test-serialize.c index b70eb3daa7..9a16688a67 100644 --- a/src/test/test-serialize.c +++ b/src/test/test-serialize.c @@ -138,7 +138,7 @@ static void test_deserialize_environment(void) { log_info("/* %s */", __func__); - assert_se(env = strv_new("A=1", NULL)); + assert_se(env = strv_new("A=1")); assert_se(deserialize_environment("B=2", &env) >= 0); assert_se(deserialize_environment("FOO%%=a\\177b\\nc\\td e", &env) >= 0); @@ -162,8 +162,7 @@ static void test_serialize_environment(void) { "B=2", "C=ąęółń", "D=D=a\\x0Ab", - "FOO%%=a\177b\nc\td e", - NULL)); + "FOO%%=a\177b\nc\td e")); assert_se(serialize_strv(f, "env", env) == 1); assert_se(fflush_and_check(f) == 0); diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c index 442541a298..2a6d5e765a 100644 --- a/src/test/test-sleep.c +++ b/src/test/test-sleep.c @@ -50,14 +50,14 @@ static int test_fiemap(const char *path) { static void test_sleep(void) { _cleanup_strv_free_ char - **standby = strv_new("standby", NULL), - **mem = strv_new("mem", NULL), - **disk = strv_new("disk", NULL), - **suspend = strv_new("suspend", NULL), - **reboot = strv_new("reboot", NULL), - **platform = strv_new("platform", NULL), - **shutdown = strv_new("shutdown", NULL), - **freez = strv_new("freeze", NULL); + **standby = strv_new("standby"), + **mem = strv_new("mem"), + **disk = strv_new("disk"), + **suspend = strv_new("suspend"), + **reboot = strv_new("reboot"), + **platform = strv_new("platform"), + **shutdown = strv_new("shutdown"), + **freez = strv_new("freeze"); int r; log_info("/* %s */", __func__); diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 5e392c75ac..63757afdce 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -441,8 +441,8 @@ static void test_strv_sort(void) { static void test_strv_extend_strv_concat(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL; - a = strv_new("without", "suffix", NULL); - b = strv_new("with", "suffix", NULL); + a = strv_new("without", "suffix"); + b = strv_new("with", "suffix"); assert_se(a); assert_se(b); @@ -457,8 +457,8 @@ static void test_strv_extend_strv_concat(void) { static void test_strv_extend_strv(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL, **n = NULL; - a = strv_new("abc", "def", "ghi", NULL); - b = strv_new("jkl", "mno", "abc", "pqr", NULL); + a = strv_new("abc", "def", "ghi"); + b = strv_new("jkl", "mno", "abc", "pqr"); assert_se(a); assert_se(b); @@ -483,7 +483,7 @@ static void test_strv_extend_strv(void) { static void test_strv_extend(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL; - a = strv_new("test", "test1", NULL); + a = strv_new("test", "test1"); assert_se(a); assert_se(strv_extend(&a, "test2") >= 0); assert_se(strv_extend(&b, "test3") >= 0); @@ -497,7 +497,7 @@ static void test_strv_extend(void) { static void test_strv_extendf(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL; - a = strv_new("test", "test1", NULL); + a = strv_new("test", "test1"); assert_se(a); assert_se(strv_extendf(&a, "test2 %s %d %s", "foo", 128, "bar") >= 0); assert_se(strv_extendf(&b, "test3 %s %s %d", "bar", "foo", 128) >= 0); @@ -513,7 +513,7 @@ static void test_strv_foreach(void) { unsigned i = 0; char **check; - a = strv_new("one", "two", "three", NULL); + a = strv_new("one", "two", "three"); assert_se(a); @@ -527,7 +527,7 @@ static void test_strv_foreach_backwards(void) { unsigned i = 2; char **check; - a = strv_new("one", "two", "three", NULL); + a = strv_new("one", "two", "three"); assert_se(a); @@ -547,8 +547,7 @@ static void test_strv_foreach_pair(void) { a = strv_new("pair_one", "pair_one", "pair_two", "pair_two", - "pair_three", "pair_three", - NULL); + "pair_three", "pair_three"); STRV_FOREACH_PAIR(x, y, a) { assert_se(streq(*x, *y)); @@ -608,7 +607,7 @@ static void test_strv_insert(void) { static void test_strv_push_prepend(void) { _cleanup_strv_free_ char **a = NULL; - a = strv_new("foo", "bar", "three", NULL); + a = strv_new("foo", "bar", "three"); assert_se(strv_push_prepend(&a, strdup("first")) >= 0); assert_se(streq(a[0], "first")); @@ -648,11 +647,11 @@ static void test_strv_equal(void) { _cleanup_strv_free_ char **b = NULL; _cleanup_strv_free_ char **c = NULL; - a = strv_new("one", "two", "three", NULL); + a = strv_new("one", "two", "three"); assert_se(a); - b = strv_new("one", "two", "three", NULL); + b = strv_new("one", "two", "three"); assert_se(a); - c = strv_new("one", "two", "three", "four", NULL); + c = strv_new("one", "two", "three", "four"); assert_se(a); assert_se(strv_equal(a, a)); @@ -667,19 +666,19 @@ static void test_strv_equal(void) { static void test_strv_is_uniq(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL, **c = NULL, **d = NULL; - a = strv_new(NULL, NULL); + a = strv_new(NULL); assert_se(a); assert_se(strv_is_uniq(a)); - b = strv_new("foo", NULL); + b = strv_new("foo"); assert_se(b); assert_se(strv_is_uniq(b)); - c = strv_new("foo", "bar", NULL); + c = strv_new("foo", "bar"); assert_se(c); assert_se(strv_is_uniq(c)); - d = strv_new("foo", "bar", "waldo", "bar", "piep", NULL); + d = strv_new("foo", "bar", "waldo", "bar", "piep"); assert_se(d); assert_se(!strv_is_uniq(d)); } @@ -687,26 +686,26 @@ static void test_strv_is_uniq(void) { static void test_strv_reverse(void) { _cleanup_strv_free_ char **a = NULL, **b = NULL, **c = NULL, **d = NULL; - a = strv_new(NULL, NULL); + a = strv_new(NULL); assert_se(a); strv_reverse(a); assert_se(strv_isempty(a)); - b = strv_new("foo", NULL); + b = strv_new("foo"); assert_se(b); strv_reverse(b); assert_se(streq_ptr(b[0], "foo")); assert_se(streq_ptr(b[1], NULL)); - c = strv_new("foo", "bar", NULL); + c = strv_new("foo", "bar"); assert_se(c); strv_reverse(c); assert_se(streq_ptr(c[0], "bar")); assert_se(streq_ptr(c[1], "foo")); assert_se(streq_ptr(c[2], NULL)); - d = strv_new("foo", "bar", "waldo", NULL); + d = strv_new("foo", "bar", "waldo"); assert_se(d); strv_reverse(d); assert_se(streq_ptr(d[0], "waldo")); @@ -718,7 +717,7 @@ static void test_strv_reverse(void) { static void test_strv_shell_escape(void) { _cleanup_strv_free_ char **v = NULL; - v = strv_new("foo:bar", "bar,baz", "wal\\do", NULL); + v = strv_new("foo:bar", "bar,baz", "wal\\do"); assert_se(v); assert_se(strv_shell_escape(v, ",:")); assert_se(streq_ptr(v[0], "foo\\:bar")); @@ -752,7 +751,7 @@ static void test_strv_skip(void) { static void test_strv_extend_n(void) { _cleanup_strv_free_ char **v = NULL; - v = strv_new("foo", "bar", NULL); + v = strv_new("foo", "bar"); assert_se(v); assert_se(strv_extend_n(&v, "waldo", 3) >= 0); @@ -808,8 +807,8 @@ static void test_strv_free_free(void) { char ***t; assert_se(t = new(char**, 3)); - assert_se(t[0] = strv_new("a", "b", NULL)); - assert_se(t[1] = strv_new("c", "d", "e", NULL)); + assert_se(t[0] = strv_new("a", "b")); + assert_se(t[1] = strv_new("c", "d", "e")); t[2] = NULL; t = strv_free_free(t); @@ -839,7 +838,7 @@ static void test_strv_fnmatch(void) { assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a", 0)); - v = strv_new("*\\*", NULL); + v = strv_new("*\\*"); assert_se(!strv_fnmatch(v, "\\", 0)); assert_se(strv_fnmatch(v, "\\", FNM_NOESCAPE)); } |