diff --git a/mu/mu-cmd-view.cc b/mu/mu-cmd-view.cc index 1e072c3b..a188ce9d 100644 --- a/mu/mu-cmd-view.cc +++ b/mu/mu-cmd-view.cc @@ -211,7 +211,7 @@ Mu::mu_cmd_view(const Options& opts) #include /* Definition of AT_* constants */ #include #include -#include +#include #include "utils/mu-test-utils.hh" static constexpr std::string_view test_msg = @@ -245,23 +245,20 @@ static std::string msgpath; static void test_view_plain() { - TempTz tz("Europe/Amsterdam"); - if (!tz.available()) { - g_test_skip("timezone not available"); - return; - } - setlocale(LC_ALL, "C"); - auto res = run_command({MU_PROGRAM, "view", msgpath}); assert_valid_command(res); auto output{*res}; + // silly hack to avoid locale diffs + auto rx = unwrap(Regex::make("^Date:.*", G_REGEX_MULTILINE)); + output.standard_out = rx.replace(output.standard_out, "Date: xxx"); + g_assert_true(output.standard_err.empty()); assert_equal(output.standard_out, R"(From: Test To: abc@example.com Subject: vla -Date: 2011-05-23T10:53:45 CEST +Date: xxx text )"); @@ -271,23 +268,19 @@ text static void test_view_html() { - TempTz tz("Europe/Amsterdam"); - if (!tz.available()) { - g_test_skip("timezone not available"); - return; - } - setlocale(LC_ALL, "C"); - auto res = run_command({MU_PROGRAM, "view", "--format=html", msgpath}); assert_valid_command(res); auto output{*res}; + auto rx = unwrap(Regex::make("^Date:.*", G_REGEX_MULTILINE)); + output.standard_out = rx.replace(output.standard_out, "Date: xxx"); + g_assert_true(output.standard_err.empty()); assert_equal(output.standard_out, R"(From: Test To: abc@example.com Subject: vla -Date: 2011-05-23T10:53:45 CEST +Date: xxx html )"); @@ -302,7 +295,6 @@ test_view_sexp() g_test_skip("timezone not available"); return; } - setlocale(LC_ALL, "C"); auto res = run_command({MU_PROGRAM, "view", "--format=sexp", msgpath}); assert_valid_command(res);