aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Yursha <31780593+yursha@users.noreply.github.com>2017-09-12 11:50:27 -0700
committerGitHub <noreply@github.com>2017-09-12 11:50:27 -0700
commit834baf336231bf03e5179ff9e79f7794d3f20319 (patch)
treedbc366b29583f0d7fe7ad434bb4dcba0761a12cb
parent4f68ab5b84dda2b364ea3350fc2a96d1cb15adf5 (diff)
parent61330388862cf011fa956f7f59082b9923e6be0e (diff)
downloadgoogletest-834baf336231bf03e5179ff9e79f7794d3f20319.tar.gz
googletest-834baf336231bf03e5179ff9e79f7794d3f20319.tar.bz2
googletest-834baf336231bf03e5179ff9e79f7794d3f20319.zip
Merge branch 'master' into patch-1
-rw-r--r--googletest/CMakeLists.txt3
-rw-r--r--googletest/samples/sample10_unittest.cc1
-rw-r--r--googletest/src/gtest.cc45
3 files changed, 19 insertions, 30 deletions
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
index 59343ed2..8391dbd0 100644
--- a/googletest/CMakeLists.txt
+++ b/googletest/CMakeLists.txt
@@ -75,9 +75,6 @@ include_directories(
${gtest_SOURCE_DIR}/include
${gtest_SOURCE_DIR})
-# Where Google Test's libraries can be found.
-link_directories(${gtest_BINARY_DIR}/src)
-
# Summary of tuple support for Microsoft Visual Studio:
# Compiler version(MS) version(cmake) Support
# ---------- ----------- -------------- -----------------------------
diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc
index 977e5ff6..10aa7620 100644
--- a/googletest/samples/sample10_unittest.cc
+++ b/googletest/samples/sample10_unittest.cc
@@ -38,7 +38,6 @@
using ::testing::EmptyTestEventListener;
using ::testing::InitGoogleTest;
using ::testing::Test;
-using ::testing::TestCase;
using ::testing::TestEventListeners;
using ::testing::TestInfo;
using ::testing::TestPartResult;
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 2484caf5..fa170e75 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -2569,10 +2569,10 @@ void ReportInvalidTestCaseType(const char* test_case_name,
<< "probably rename one of the classes to put the tests into different\n"
<< "test cases.";
- fprintf(stderr, "%s %s",
- FormatFileLocation(code_location.file.c_str(),
- code_location.line).c_str(),
- errors.GetString().c_str());
+ GTEST_LOG_(ERROR)
+ << FormatFileLocation(code_location.file.c_str(),
+ code_location.line)
+ << " " << errors.GetString();
}
#endif // GTEST_HAS_PARAM_TEST
@@ -3449,9 +3449,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
: output_file_(output_file) {
if (output_file_.c_str() == NULL || output_file_.empty()) {
- fprintf(stderr, "XML output file may not be null\n");
- fflush(stderr);
- exit(EXIT_FAILURE);
+ GTEST_LOG_(FATAL) << "XML output file may not be null";
}
}
@@ -3476,11 +3474,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
// 3. To interpret the meaning of errno in a thread-safe way,
// we need the strerror_r() function, which is not available on
// Windows.
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- output_file_.c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
+ GTEST_LOG_(FATAL) << "Unable to open file \""
+ << output_file_ << "\"";
}
std::stringstream stream;
PrintXmlUnitTest(&stream, unit_test);
@@ -4431,9 +4426,9 @@ void UnitTestImpl::ConfigureXmlOutput() {
listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
} else if (output_format != "") {
- printf("WARNING: unrecognized output format \"%s\" ignored.\n",
- output_format.c_str());
- fflush(stdout);
+ GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
+ << output_format
+ << "\" ignored.";
}
}
@@ -4448,9 +4443,9 @@ void UnitTestImpl::ConfigureStreamingOutput() {
listeners()->Append(new StreamingListener(target.substr(0, pos),
target.substr(pos+1)));
} else {
- printf("WARNING: unrecognized streaming target \"%s\" ignored.\n",
- target.c_str());
- fflush(stdout);
+ GTEST_LOG_(WARNING) << "unrecognized streaming target \""
+ << target
+ << "\" ignored.";
}
}
}
@@ -4579,9 +4574,9 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); }
bool UnitTestImpl::RunAllTests() {
// Makes sure InitGoogleTest() was called.
if (!GTestIsInitialized()) {
- printf("%s",
- "\nThis test program did NOT call ::testing::InitGoogleTest "
- "before calling RUN_ALL_TESTS(). Please fix it.\n");
+ GTEST_LOG_(ERROR) <<
+ "\nThis test program did NOT call ::testing::InitGoogleTest "
+ "before calling RUN_ALL_TESTS(). Please fix it.";
return false;
}
@@ -5281,11 +5276,9 @@ bool ParseGoogleTestFlag(const char* const arg) {
void LoadFlagsFromFile(const std::string& path) {
FILE* flagfile = posix::FOpen(path.c_str(), "r");
if (!flagfile) {
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- GTEST_FLAG(flagfile).c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
+ GTEST_LOG_(FATAL) << "Unable to open file \""
+ << GTEST_FLAG(flagfile)
+ << "\"";
}
std::string contents(ReadEntireFile(flagfile));
posix::FClose(flagfile);