# HG changeset patch # User Stephan Bosch # Date 1483975229 -3600 # Node ID 98ee758c138e0e85f0c1275c0a30576767565ddd # Parent e2aa2a18fe1608603e94dd6d1604571f5193746f lib-imap: test-imap-bodystructure: Improved handing of parse errors. Actually show the parse error. diff -r e2aa2a18fe16 -r 98ee758c138e src/lib-imap/test-imap-bodystructure.c --- a/src/lib-imap/test-imap-bodystructure.c Mon Jan 09 16:16:46 2017 +0100 +++ b/src/lib-imap/test-imap-bodystructure.c Mon Jan 09 16:20:29 2017 +0100 @@ -128,6 +128,7 @@ struct message_part *parts; const char *error; unsigned int i; + int ret; for (i = 0; i < parse_tests_count; i++) T_BEGIN { struct parse_test *test = &parse_tests[i]; @@ -141,12 +142,17 @@ str, &error) == 0); test_assert(strcmp(str_c(str), test->body) == 0); - test_assert(imap_bodystructure_parse(test->bodystructure, - pool, parts, &error) == 0); + ret = imap_bodystructure_parse(test->bodystructure, + pool, parts, &error); + test_assert(ret == 0); - str_truncate(str, 0); - imap_bodystructure_write(parts, str, TRUE); - test_assert(strcmp(str_c(str), test->bodystructure) == 0); + if (ret == 0) { + str_truncate(str, 0); + imap_bodystructure_write(parts, str, TRUE); + test_assert(strcmp(str_c(str), test->bodystructure) == 0); + } else { + i_error("Invalid BODYSTRUCTURE: %s", error); + } pool_unref(&pool); test_end();