changeset 19442:374db78da9f0

lib-mail: test-rfc822-parser unit test fix We didn't check that all the output was necessarily verified. Also this makes static analyzer happier.
author Timo Sirainen <tss@iki.fi>
date Tue, 01 Dec 2015 16:45:37 +0200
parents b0e2a14d5a40
children 25d63d9c7f5a
files src/lib-mail/test-rfc822-parser.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/test-rfc822-parser.c	Mon Nov 30 21:39:56 2015 +0200
+++ b/src/lib-mail/test-rfc822-parser.c	Tue Dec 01 16:45:37 2015 +0200
@@ -54,12 +54,14 @@
 
 	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();
 }