From 6c98915a9c024791e57e1ebd22c8a5fc80bcd9fd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 29 Jan 2022 20:52:37 -0500 Subject: [PATCH] port to windows --- unittest/commands/test_simple_commands.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index c75cbb22b9..862c3a8c4a 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -478,7 +478,12 @@ TEST_F(SimpleCommandsTest, Shell) test_var = getenv("TEST_VARIABLE"); ASSERT_NE(test_var, nullptr); +#if defined(_WIN32) + // we cannot create empty environment variables on Windows so platform::putenv() sets their value to "1" + ASSERT_THAT(test_var, StrEq("1")); +#else ASSERT_THAT(test_var, StrEq("")); +#endif } TEST_F(SimpleCommandsTest, CiteMe) @@ -495,8 +500,8 @@ TEST_F(SimpleCommandsTest, CiteMe) std::string text = END_CAPTURE_OUTPUT(); // find the two unique citations, but not the third - ASSERT_THAT(text, ContainsRegex(".*one.*two.*")); - ASSERT_THAT(text, Not(ContainsRegex(".*one.*two.*one.*"))); + ASSERT_THAT(text, ContainsRegex("test citation one.\n.*test citation two.*")); + ASSERT_THAT(text, Not(ContainsRegex("test citation one.\n.*test citation two.*\n.*test citation one.*"))); BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 0\n"); @@ -507,8 +512,8 @@ TEST_F(SimpleCommandsTest, CiteMe) text = END_CAPTURE_OUTPUT(); // find the forth (only differs in long citation) and sixth added citation - ASSERT_THAT(text, ContainsRegex(".*one.*three.*")); - ASSERT_THAT(text, Not(ContainsRegex(".*two.*"))); + ASSERT_THAT(text, ContainsRegex("test citation one.*\n.*test citation three.*")); + ASSERT_THAT(text, Not(ContainsRegex("test_citation two.*\n"))); BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 1\n");