fclose(f);
}
+static const char *formatted_text1 =
+"Subject: =?utf-8?q?Welcome_to_test=40test?=\n"
+"From: test+help@test\n"
+"To: john@doe.net\n"
+"Message-ID: <1636022023-16598-mlmmj-39117dfa@test>\n"
+"Date: Thu, 04 Nov 2021 10:33:43 +0000\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"\n"
+"\n"
+"Thank you for your request to join us. You have now been added to the\n"
+"normal version of the list.\n"
+"\n"
+"The email address you are subscribed with is <john@doe.net>.\n"
+"\n"
+"If you ever wish to unsubscribe, send a message to <test+unsubscribe@test>\n"
+"using this email address. The subject and the body of the message can be\n"
+"anything. You will then receive confirmation or further instructions.\n"
+"\n"
+"For other information and help about this list, send a message to\n"
+"<test+help@test>.\n"
+"\n";
+
ATF_TC_BODY(open_text, tc)
{
struct mlmmj_list list;
list.entext = SRCDIR "/listtexts/en";
text *txt = open_text(&list, "finish", "sub", "request", "normal", "sub-confirm");
ATF_CHECK(txt != NULL);
+ register_unformatted(txt, "subaddr", "john@doe.net");
+ char *qname = prepstdreply(txt, &list, "$helpaddr$", "john@doe.net", NULL);
+ if (!atf_utils_grep_file("^To: john@doe.net", qname) ||
+ !atf_utils_grep_file("^The email address .*john@doe.net.*", qname) ||
+ !atf_utils_grep_file("^Subject: .*Welcome_to_test", qname)) {
+ printf("===== generated ====\n");
+ atf_utils_cat_file(qname, "");
+ printf("===== expected ====\n");
+ printf("%s", formatted_text1);
+ printf("===================\n");
+ atf_tc_fail("Invalid formatted mail");
+ }
+ ATF_CHECK(qname != NULL);
}
ATF_TP_ADD_TCS(tp)