Skip to content

Commit

Permalink
mu-view: check for timezone availability in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
djcb committed Jul 29, 2023
1 parent 766d184 commit 3ada6af
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions mu/mu-cmd-view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ static std::string msgpath;
static void
test_view_plain()
{
TempTz tz("Europe/Amsterdam");
if (!tz.available()) {
g_test_skip("timezone not available");
return;
}

auto res = run_command({MU_PROGRAM, "view", msgpath});
assert_valid_command(res);
auto output{*res};
Expand All @@ -263,6 +269,12 @@ text
static void
test_view_html()
{
TempTz tz("Europe/Amsterdam");
if (!tz.available()) {
g_test_skip("timezone not available");
return;
}

auto res = run_command({MU_PROGRAM, "view", "--format=html", msgpath});
assert_valid_command(res);
auto output{*res};
Expand All @@ -282,6 +294,12 @@ html
static void
test_view_sexp()
{
TempTz tz("Europe/Amsterdam");
if (!tz.available()) {
g_test_skip("timezone not available");
return;
}

auto res = run_command({MU_PROGRAM, "view", "--format=sexp", msgpath});
assert_valid_command(res);
auto output{*res};
Expand Down Expand Up @@ -312,8 +330,6 @@ main(int argc, char* argv[]) try {
strm.close();
g_assert_true(strm.good());

set_tz("Europe/Amsterdam");

mu_test_init(&argc, &argv);

g_test_add_func("/cmd/view/plain", test_view_plain);
Expand Down

0 comments on commit 3ada6af

Please sign in to comment.