dovecot-2.2: lib-mail: test-rfc822-parser unit test fix

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 1 14:45:51 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/374db78da9f0
changeset: 19442:374db78da9f0
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 01 16:45:37 2015 +0200
description:
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.

diffstat:

 src/lib-mail/test-rfc822-parser.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r b0e2a14d5a40 -r 374db78da9f0 src/lib-mail/test-rfc822-parser.c
--- 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();
 }
 


More information about the dovecot-cvs mailing list