summaryrefslogtreecommitdiff
path: root/src/test/test-strv.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-03-09 23:53:54 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-03-09 23:53:54 -0500
commitc41d3b3a0ca1c53cbf05563f00bcef72db58d9b0 (patch)
tree69df8196e11ecb321ab321edd5cb0cf22d2a4c41 /src/test/test-strv.c
parentef240bf0df222fd336b31bde9ac1472244cb3453 (diff)
parent31b5d9898129b6a1890ef5e004e5db5bbbf5f9e5 (diff)
Merge pull request #2792 from ronnychevalier/rc/tests_movev2
tests: move out unrelated tests from test-util to their own file
Diffstat (limited to 'src/test/test-strv.c')
-rw-r--r--src/test/test-strv.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index ef451c6abf..fea1f848cd 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -660,6 +660,25 @@ static void test_strv_make_nulstr(void) {
test_strv_make_nulstr_one(STRV_MAKE("foo", "bar", "quuux"));
}
+static void test_foreach_string(void) {
+ const char * const t[] = {
+ "foo",
+ "bar",
+ "waldo",
+ NULL
+ };
+ const char *x;
+ unsigned i = 0;
+
+ FOREACH_STRING(x, "foo", "bar", "waldo")
+ assert_se(streq_ptr(t[i++], x));
+
+ assert_se(i == 3);
+
+ FOREACH_STRING(x, "zzz")
+ assert_se(streq(x, "zzz"));
+}
+
int main(int argc, char *argv[]) {
test_specifier_printf();
test_strv_foreach();
@@ -724,5 +743,7 @@ int main(int argc, char *argv[]) {
test_strv_extend_n();
test_strv_make_nulstr();
+ test_foreach_string();
+
return 0;
}