Adds new matcher Pair(). Replaces GMOCK_CHECK_ with GTEST_CHECK_ (by Vlad Losev).
This commit is contained in:
@@ -36,61 +36,4 @@
|
||||
#include <gmock/internal/gmock-port.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(GmockCheckSyntaxTest, BehavesLikeASingleStatement) {
|
||||
if (false)
|
||||
GMOCK_CHECK_(false) << "This should never be executed; "
|
||||
"It's a compilation test only.";
|
||||
|
||||
if (true)
|
||||
GMOCK_CHECK_(true);
|
||||
else
|
||||
;
|
||||
|
||||
if (false)
|
||||
;
|
||||
else
|
||||
GMOCK_CHECK_(true) << "";
|
||||
}
|
||||
|
||||
TEST(GmockCheckSyntaxTest, WorksWithSwitch) {
|
||||
switch (0) {
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
GMOCK_CHECK_(true);
|
||||
}
|
||||
|
||||
switch(0)
|
||||
case 0:
|
||||
GMOCK_CHECK_(true) << "Check failed in switch case";
|
||||
}
|
||||
|
||||
TEST(GmockCheckDeathTest, DiesWithCorrectOutputOnFailure) {
|
||||
const bool a_false_condition = false;
|
||||
// MSVC and gcc use different formats to print source file locations.
|
||||
// Google Mock's failure messages use the same format as used by the
|
||||
// compiler, in order for the IDE to recognize them. Therefore we look
|
||||
// for different patterns here depending on the compiler.
|
||||
const char regex[] =
|
||||
#ifdef _MSC_VER
|
||||
"gmock-port_test\\.cc\\(\\d+\\):"
|
||||
#else
|
||||
"gmock-port_test\\.cc:[0-9]+"
|
||||
#endif // _MSC_VER
|
||||
".*a_false_condition.*Extra info";
|
||||
|
||||
EXPECT_DEATH_IF_SUPPORTED(GMOCK_CHECK_(a_false_condition) << "Extra info",
|
||||
regex);
|
||||
}
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(GmockCheckDeathTest, LivesSilentlyOnSuccess) {
|
||||
EXPECT_EXIT({
|
||||
GMOCK_CHECK_(true) << "Extra info";
|
||||
::std::cerr << "Success\n";
|
||||
exit(0); },
|
||||
::testing::ExitedWithCode(0), "Success");
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
// This file intentionally contains no test at this moment.
|
||||
|
||||
Reference in New Issue
Block a user