]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: test-rfc822-parser unit test fix
authorTimo Sirainen <tss@iki.fi>
Tue, 1 Dec 2015 14:45:37 +0000 (16:45 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 1 Dec 2015 14:45:37 +0000 (16:45 +0200)
We didn't check that all the output was necessarily verified. Also this
makes static analyzer happier.

src/lib-mail/test-rfc822-parser.c

index 70a871b62f3c7ee4e0b7f9ee9653a34542645e57..b4fbfa9456e1bb18f0d349d02dbaa5a7abc76cc5 100644 (file)
@@ -54,12 +54,14 @@ static void test_rfc822_parse_content_param(void)
 
        test_begin("rfc822 parse content param");
        rfc822_parser_init(&parser, (const void *)input, strlen(input), NULL);
-       while ((ret = rfc822_parse_content_param(&parser, &key, &value)) > 0) {
+       while ((ret = rfc822_parse_content_param(&parser, &key, &value)) > 0 &&
+              i < N_ELEMENTS(output)) {
                test_assert_idx(strcmp(output[i].key, key) == 0, i);
                test_assert_idx(strcmp(output[i].value, value) == 0, i);
                i++;
        }
        test_assert(ret == 0);
+       test_assert(i == N_ELEMENTS(output));
        test_end();
 }