summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Bour <jean-sebastien@bour.name>2016-07-09 02:38:00 +0200
committerJean-Sébastien Bour <jean-sebastien@bour.name>2016-07-17 18:14:59 +0200
commitf41794d0360b8e3a705db58df14957ceb37c6f27 (patch)
tree5810336f6e64a1fb1f2682a99681db211d473d0a /src
parentccc2c98e1b0c06861577632440b996ca16cefd53 (diff)
basic/strv: exhibit strv_make_nulstr missing final NUL char (systemd/systemd#3689)
Diffstat (limited to 'src')
-rw-r--r--src/test/test-strv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index f7a1217df7..91265c9cba 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -647,7 +647,9 @@ static void test_strv_extend_n(void) {
static void test_strv_make_nulstr_one(char **l) {
_cleanup_free_ char *b = NULL, *c = NULL;
_cleanup_strv_free_ char **q = NULL;
+ const char *s = NULL;
size_t n, m;
+ unsigned i = 0;
assert_se(strv_make_nulstr(l, &b, &n) >= 0);
assert_se(q = strv_parse_nulstr(b, n));
@@ -656,6 +658,11 @@ static void test_strv_make_nulstr_one(char **l) {
assert_se(strv_make_nulstr(q, &c, &m) >= 0);
assert_se(m == n);
assert_se(memcmp(b, c, m) == 0);
+
+ NULSTR_FOREACH(s, b) {
+ assert_se(streq(s, l[i++]));
+ }
+ assert_se(i == strv_length(l));
}
static void test_strv_make_nulstr(void) {