Skip to content

Commit

Permalink
Stop using GoogleTest's SUCCEED given latest MSVC errors
Browse files Browse the repository at this point in the history
See: google/googletest#4556
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti committed Jun 7, 2024
1 parent e17f55e commit 68d7489
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cmake/CompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function(sourcemeta_jsontoolkit_add_compile_options target)
/WL
/MP
/sdl)

if(BUILD_SHARED_LIBS)
target_compile_options("${target}" PRIVATE /MT)
endif()
else()
target_compile_options("${target}" PRIVATE
-Wall
Expand Down
1 change: 0 additions & 1 deletion test/json/json_parse_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
} catch (const sourcemeta::jsontoolkit::ParseError &error) { \
EXPECT_EQ(error.line(), expected_line); \
EXPECT_EQ(error.column(), expected_column); \
SUCCEED(); \
} catch (const std::exception &) { \
FAIL() << "The parse function was expected to throw a parse error"; \
}
Expand Down
4 changes: 4 additions & 0 deletions test/json/jsontestsuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ class JSONTest : public testing::Test {
sourcemeta::jsontoolkit::parse(stream);
}
} catch (const sourcemeta::jsontoolkit::ParseError &) {
// As SUCCEED() is broken on MSVC
// See https://github.com/google/googletest/issues/4556
#if !defined(_MSC_VER)
SUCCEED();
#endif
} catch (const std::exception &) {
FAIL() << "The parse function threw an unexpected error";
}
Expand Down
1 change: 0 additions & 1 deletion test/jsonl/jsonl_parse_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
} catch (const sourcemeta::jsontoolkit::ParseError &error) { \
EXPECT_EQ(error.line(), expected_line); \
EXPECT_EQ(error.column(), expected_column); \
SUCCEED(); \
} catch (const std::exception &) { \
FAIL() << "The JSONL parser was expected to throw a parse error"; \
}
Expand Down
3 changes: 1 addition & 2 deletions test/jsonpointer/jsonpointer_parse_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
sourcemeta::jsontoolkit::parse(stream.str()); \
FAIL() << "The parse function was expected to throw"; \
} catch (const sourcemeta::jsontoolkit::ParseError &) { \
SUCCEED(); \
EXPECT_TRUE(true); \
} catch (const std::exception &) { \
FAIL() << "The parse operation threw an unexpected error"; \
}
Expand All @@ -24,7 +24,6 @@
FAIL() << "The to_pointer function was expected to throw"; \
} catch (const sourcemeta::jsontoolkit::PointerParseError &error) { \
EXPECT_EQ(error.column(), expected_column); \
SUCCEED(); \
} catch (const std::exception &) { \
FAIL() << "The to_pointer function threw an unexpected error"; \
}
Expand Down

0 comments on commit 68d7489

Please sign in to comment.