]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-var-expand: test-var-expand - Print more useful error if test->out is empty
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 10 Nov 2025 08:35:00 +0000 (10:35 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 11 Nov 2025 10:17:51 +0000 (10:17 +0000)
src/lib-var-expand/test-var-expand.c

index 750ed65c49fdbe9d019ff740b8e316789ac193d0..e2c4b5a0e6f1dd4980810686f5b8a88655a7b1e4 100644 (file)
@@ -44,10 +44,12 @@ static void run_var_expand_tests(const struct var_expand_params *params,
                        test_assert_idx(error != NULL, i);
                        test_assert_idx(dest->used == 0,i );
                        if (test->ret < 0) {
-                               i_assert(test->out != NULL && *test->out != '\0');
+                               i_assert(test->out != NULL);
                                const char *match = strstr(error, test->out);
                                test_assert_idx(match != NULL, i);
-                               if (match == NULL) {
+                               if (*test->out == '\0')
+                                       i_debug("unexpected error '%s'", error);
+                               else if (match == NULL) {
                                        i_debug("error '%s' does not contain '%s'",
                                                error, test->out);
                                }