Commit 6c093a23 authored by Scott Slack-Smith's avatar Scott Slack-Smith
Browse files

Merge branch 'master' of https://github.com/google/googletest

parents c958e26f d175c8bf
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "prime_tables.h" #include "prime_tables.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace {
// First, we define some factory functions for creating instances of // First, we define some factory functions for creating instances of
// the implementations. You may be able to skip this step if all your // the implementations. You may be able to skip this step if all your
// implementations can be constructed the same way. // implementations can be constructed the same way.
...@@ -222,3 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name ...@@ -222,3 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name
PrimeTableImplementations); // Type list PrimeTableImplementations); // Type list
#endif // GTEST_HAS_TYPED_TEST_P #endif // GTEST_HAS_TYPED_TEST_P
} // namespace
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "prime_tables.h" #include "prime_tables.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace {
#if GTEST_HAS_PARAM_TEST #if GTEST_HAS_PARAM_TEST
using ::testing::TestWithParam; using ::testing::TestWithParam;
...@@ -65,9 +65,9 @@ PrimeTable* CreatePreCalculatedPrimeTable() { ...@@ -65,9 +65,9 @@ PrimeTable* CreatePreCalculatedPrimeTable() {
// can refer to the test parameter by GetParam(). In this case, the test // can refer to the test parameter by GetParam(). In this case, the test
// parameter is a factory function which we call in fixture's SetUp() to // parameter is a factory function which we call in fixture's SetUp() to
// create and store an instance of PrimeTable. // create and store an instance of PrimeTable.
class PrimeTableTest : public TestWithParam<CreatePrimeTableFunc*> { class PrimeTableTestSmpl7 : public TestWithParam<CreatePrimeTableFunc*> {
public: public:
virtual ~PrimeTableTest() { delete table_; } virtual ~PrimeTableTestSmpl7() { delete table_; }
virtual void SetUp() { table_ = (*GetParam())(); } virtual void SetUp() { table_ = (*GetParam())(); }
virtual void TearDown() { virtual void TearDown() {
delete table_; delete table_;
...@@ -78,7 +78,7 @@ class PrimeTableTest : public TestWithParam<CreatePrimeTableFunc*> { ...@@ -78,7 +78,7 @@ class PrimeTableTest : public TestWithParam<CreatePrimeTableFunc*> {
PrimeTable* table_; PrimeTable* table_;
}; };
TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { TEST_P(PrimeTableTestSmpl7, ReturnsFalseForNonPrimes) {
EXPECT_FALSE(table_->IsPrime(-5)); EXPECT_FALSE(table_->IsPrime(-5));
EXPECT_FALSE(table_->IsPrime(0)); EXPECT_FALSE(table_->IsPrime(0));
EXPECT_FALSE(table_->IsPrime(1)); EXPECT_FALSE(table_->IsPrime(1));
...@@ -87,7 +87,7 @@ TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { ...@@ -87,7 +87,7 @@ TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) {
EXPECT_FALSE(table_->IsPrime(100)); EXPECT_FALSE(table_->IsPrime(100));
} }
TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { TEST_P(PrimeTableTestSmpl7, ReturnsTrueForPrimes) {
EXPECT_TRUE(table_->IsPrime(2)); EXPECT_TRUE(table_->IsPrime(2));
EXPECT_TRUE(table_->IsPrime(3)); EXPECT_TRUE(table_->IsPrime(3));
EXPECT_TRUE(table_->IsPrime(5)); EXPECT_TRUE(table_->IsPrime(5));
...@@ -96,7 +96,7 @@ TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { ...@@ -96,7 +96,7 @@ TEST_P(PrimeTableTest, ReturnsTrueForPrimes) {
EXPECT_TRUE(table_->IsPrime(131)); EXPECT_TRUE(table_->IsPrime(131));
} }
TEST_P(PrimeTableTest, CanGetNextPrime) { TEST_P(PrimeTableTestSmpl7, CanGetNextPrime) {
EXPECT_EQ(2, table_->GetNextPrime(0)); EXPECT_EQ(2, table_->GetNextPrime(0));
EXPECT_EQ(3, table_->GetNextPrime(2)); EXPECT_EQ(3, table_->GetNextPrime(2));
EXPECT_EQ(5, table_->GetNextPrime(3)); EXPECT_EQ(5, table_->GetNextPrime(3));
...@@ -112,10 +112,9 @@ TEST_P(PrimeTableTest, CanGetNextPrime) { ...@@ -112,10 +112,9 @@ TEST_P(PrimeTableTest, CanGetNextPrime) {
// //
// Here, we instantiate our tests with a list of two PrimeTable object // Here, we instantiate our tests with a list of two PrimeTable object
// factory functions: // factory functions:
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
OnTheFlyAndPreCalculated, Values(&CreateOnTheFlyPrimeTable,
PrimeTableTest, &CreatePreCalculatedPrimeTable<1000>));
Values(&CreateOnTheFlyPrimeTable, &CreatePreCalculatedPrimeTable<1000>));
#else #else
...@@ -128,3 +127,4 @@ INSTANTIATE_TEST_CASE_P( ...@@ -128,3 +127,4 @@ INSTANTIATE_TEST_CASE_P(
TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {} TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
#endif // GTEST_HAS_PARAM_TEST #endif // GTEST_HAS_PARAM_TEST
} // namespace
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "prime_tables.h" #include "prime_tables.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace {
#if GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
// Suppose we want to introduce a new, improved implementation of PrimeTable // Suppose we want to introduce a new, improved implementation of PrimeTable
...@@ -171,3 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, ...@@ -171,3 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {}
#endif // GTEST_HAS_COMBINE #endif // GTEST_HAS_COMBINE
} // namespace
...@@ -44,9 +44,7 @@ using ::testing::TestEventListeners; ...@@ -44,9 +44,7 @@ using ::testing::TestEventListeners;
using ::testing::TestInfo; using ::testing::TestInfo;
using ::testing::TestPartResult; using ::testing::TestPartResult;
using ::testing::UnitTest; using ::testing::UnitTest;
namespace { namespace {
// Provides alternative output mode which produces minimal amount of // Provides alternative output mode which produces minimal amount of
// information about tests. // information about tests.
class TersePrinter : public EmptyTestEventListener { class TersePrinter : public EmptyTestEventListener {
...@@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) { ...@@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) {
EXPECT_EQ(1, 2) EXPECT_EQ(1, 2)
<< "This test fails in order to demonstrate alternative failure messages"; << "This test fails in order to demonstrate alternative failure messages";
} }
} // namespace } // namespace
int main(int argc, char **argv) { int main(int argc, char **argv) {
......
...@@ -52,7 +52,7 @@ EXAMPLES ...@@ -52,7 +52,7 @@ EXAMPLES
This tool is experimental. In particular, it assumes that there is no This tool is experimental. In particular, it assumes that there is no
conditional inclusion of Google Test headers. Please report any conditional inclusion of Google Test headers. Please report any
problems to googletestframework@googlegroups.com. You can read problems to googletestframework@googlegroups.com. You can read
http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md for
more information. more information.
""" """
......
...@@ -732,7 +732,7 @@ class SubversionVCS(VersionControlSystem): ...@@ -732,7 +732,7 @@ class SubversionVCS(VersionControlSystem):
else: else:
self.rev_start = self.rev_end = None self.rev_start = self.rev_end = None
# Cache output from "svn list -r REVNO dirname". # Cache output from "svn list -r REVNO dirname".
# Keys: dirname, Values: 2-tuple (ouput for start rev and end rev). # Keys: dirname, Values: 2-tuple (output for start rev and end rev).
self.svnls_cache = {} self.svnls_cache = {}
# SVN base URL is required to fetch files deleted in an older revision. # SVN base URL is required to fetch files deleted in an older revision.
# Result is cached to not guess it over and over again in GetBaseFile(). # Result is cached to not guess it over and over again in GetBaseFile().
......
...@@ -1242,7 +1242,7 @@ int GetStatusFileDescriptor(unsigned int parent_process_id, ...@@ -1242,7 +1242,7 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
reinterpret_cast<HANDLE>(write_handle_as_size_t); reinterpret_cast<HANDLE>(write_handle_as_size_t);
HANDLE dup_write_handle; HANDLE dup_write_handle;
// The newly initialized handle is accessible only in in the parent // The newly initialized handle is accessible only in the parent
// process. To obtain one accessible within the child, we need to use // process. To obtain one accessible within the child, we need to use
// DuplicateHandle. // DuplicateHandle.
if (!::DuplicateHandle(parent_process_handle.Get(), write_handle, if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
......
...@@ -537,7 +537,7 @@ class ThreadLocalRegistryImpl { ...@@ -537,7 +537,7 @@ class ThreadLocalRegistryImpl {
FALSE, FALSE,
thread_id); thread_id);
GTEST_CHECK_(thread != NULL); GTEST_CHECK_(thread != NULL);
// We need to to pass a valid thread ID pointer into CreateThread for it // We need to pass a valid thread ID pointer into CreateThread for it
// to work correctly under Win98. // to work correctly under Win98.
DWORD watcher_thread_id; DWORD watcher_thread_id;
HANDLE watcher_thread = ::CreateThread( HANDLE watcher_thread = ::CreateThread(
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
...@@ -310,7 +310,8 @@ namespace internal { ...@@ -310,7 +310,8 @@ namespace internal {
// than kMaxRange. // than kMaxRange.
UInt32 Random::Generate(UInt32 range) { UInt32 Random::Generate(UInt32 range) {
// These constants are the same as are used in glibc's rand(3). // These constants are the same as are used in glibc's rand(3).
state_ = (1103515245U*state_ + 12345U) % kMaxRange; // Use wider types than necessary to prevent unsigned overflow diagnostics.
state_ = static_cast<UInt32>(1103515245ULL*state_ + 12345U) % kMaxRange;
GTEST_CHECK_(range > 0) GTEST_CHECK_(range > 0)
<< "Cannot generate a number in the range [0, 0)."; << "Cannot generate a number in the range [0, 0).";
...@@ -1168,7 +1169,7 @@ class Hunk { ...@@ -1168,7 +1169,7 @@ class Hunk {
// Print a unified diff header for one hunk. // Print a unified diff header for one hunk.
// The format is // The format is
// "@@ -<left_start>,<left_length> +<right_start>,<right_length> @@" // "@@ -<left_start>,<left_length> +<right_start>,<right_length> @@"
// where the left/right parts are ommitted if unnecessary. // where the left/right parts are omitted if unnecessary.
void PrintHeader(std::ostream* ss) const { void PrintHeader(std::ostream* ss) const {
*ss << "@@ "; *ss << "@@ ";
if (removes_) { if (removes_) {
...@@ -1312,13 +1313,14 @@ AssertionResult EqFailure(const char* lhs_expression, ...@@ -1312,13 +1313,14 @@ AssertionResult EqFailure(const char* lhs_expression,
const std::string& rhs_value, const std::string& rhs_value,
bool ignoring_case) { bool ignoring_case) {
Message msg; Message msg;
msg << " Expected: " << lhs_expression; msg << "Expected equality of these values:";
msg << "\n " << lhs_expression;
if (lhs_value != lhs_expression) { if (lhs_value != lhs_expression) {
msg << "\n Which is: " << lhs_value; msg << "\n Which is: " << lhs_value;
} }
msg << "\nTo be equal to: " << rhs_expression; msg << "\n " << rhs_expression;
if (rhs_value != rhs_expression) { if (rhs_value != rhs_expression) {
msg << "\n Which is: " << rhs_value; msg << "\n Which is: " << rhs_value;
} }
if (ignoring_case) { if (ignoring_case) {
...@@ -1781,7 +1783,7 @@ std::string CodePointToUtf8(UInt32 code_point) { ...@@ -1781,7 +1783,7 @@ std::string CodePointToUtf8(UInt32 code_point) {
return str; return str;
} }
// The following two functions only make sense if the the system // The following two functions only make sense if the system
// uses UTF-16 for wide string encoding. All supported systems // uses UTF-16 for wide string encoding. All supported systems
// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16. // with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
...@@ -2568,10 +2570,10 @@ void ReportInvalidTestCaseType(const char* test_case_name, ...@@ -2568,10 +2570,10 @@ void ReportInvalidTestCaseType(const char* test_case_name,
<< "probably rename one of the classes to put the tests into different\n" << "probably rename one of the classes to put the tests into different\n"
<< "test cases."; << "test cases.";
fprintf(stderr, "%s %s", GTEST_LOG_(ERROR)
FormatFileLocation(code_location.file.c_str(), << FormatFileLocation(code_location.file.c_str(),
code_location.line).c_str(), code_location.line)
errors.GetString().c_str()); << " " << errors.GetString();
} }
#endif // GTEST_HAS_PARAM_TEST #endif // GTEST_HAS_PARAM_TEST
...@@ -2894,6 +2896,33 @@ WORD GetColorAttribute(GTestColor color) { ...@@ -2894,6 +2896,33 @@ WORD GetColorAttribute(GTestColor color) {
} }
} }
int GetBitOffset(WORD color_mask) {
if (color_mask == 0) return 0;
int bitOffset = 0;
while((color_mask & 1) == 0) {
color_mask >>= 1;
++bitOffset;
}
return bitOffset;
}
WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
// Let's reuse the BG
static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
const WORD existing_bg = old_color_attrs & background_mask;
WORD new_color = GetColorAttribute(color) | existing_bg | FOREGROUND_INTENSITY;
static const int bg_bitOffset = GetBitOffset(background_mask);
static const int fg_bitOffset = GetBitOffset(foreground_mask);
if (((new_color & background_mask) >> bg_bitOffset) == ((new_color & foreground_mask) >> fg_bitOffset)) {
new_color ^= FOREGROUND_INTENSITY; //invert intensity
}
return new_color;
}
#else #else
// Returns the ANSI color code for the given color. COLOR_DEFAULT is // Returns the ANSI color code for the given color. COLOR_DEFAULT is
...@@ -2979,13 +3008,14 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { ...@@ -2979,13 +3008,14 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
CONSOLE_SCREEN_BUFFER_INFO buffer_info; CONSOLE_SCREEN_BUFFER_INFO buffer_info;
GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
const WORD old_color_attrs = buffer_info.wAttributes; const WORD old_color_attrs = buffer_info.wAttributes;
const WORD new_color = GetNewColor(color, old_color_attrs);
// We need to flush the stream buffers into the console before each // We need to flush the stream buffers into the console before each
// SetConsoleTextAttribute call lest it affect the text that is already // SetConsoleTextAttribute call lest it affect the text that is already
// printed but has not yet reached the console. // printed but has not yet reached the console.
fflush(stdout); fflush(stdout);
SetConsoleTextAttribute(stdout_handle, SetConsoleTextAttribute(stdout_handle, new_color);
GetColorAttribute(color) | FOREGROUND_INTENSITY);
vprintf(fmt, args); vprintf(fmt, args);
fflush(stdout); fflush(stdout);
...@@ -3420,9 +3450,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { ...@@ -3420,9 +3450,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
: output_file_(output_file) { : output_file_(output_file) {
if (output_file_.c_str() == NULL || output_file_.empty()) { if (output_file_.c_str() == NULL || output_file_.empty()) {
fprintf(stderr, "XML output file may not be null\n"); GTEST_LOG_(FATAL) << "XML output file may not be null";
fflush(stderr);
exit(EXIT_FAILURE);
} }
} }
...@@ -3447,11 +3475,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, ...@@ -3447,11 +3475,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
// 3. To interpret the meaning of errno in a thread-safe way, // 3. To interpret the meaning of errno in a thread-safe way,
// we need the strerror_r() function, which is not available on // we need the strerror_r() function, which is not available on
// Windows. // Windows.
fprintf(stderr, GTEST_LOG_(FATAL) << "Unable to open file \""
"Unable to open file \"%s\"\n", << output_file_ << "\"";
output_file_.c_str());
fflush(stderr);
exit(EXIT_FAILURE);
} }
std::stringstream stream; std::stringstream stream;
PrintXmlUnitTest(&stream, unit_test); PrintXmlUnitTest(&stream, unit_test);
...@@ -4402,9 +4427,9 @@ void UnitTestImpl::ConfigureXmlOutput() { ...@@ -4402,9 +4427,9 @@ void UnitTestImpl::ConfigureXmlOutput() {
listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
} else if (output_format != "") { } else if (output_format != "") {
printf("WARNING: unrecognized output format \"%s\" ignored.\n", GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
output_format.c_str()); << output_format
fflush(stdout); << "\" ignored.";
} }
} }
...@@ -4419,9 +4444,9 @@ void UnitTestImpl::ConfigureStreamingOutput() { ...@@ -4419,9 +4444,9 @@ void UnitTestImpl::ConfigureStreamingOutput() {
listeners()->Append(new StreamingListener(target.substr(0, pos), listeners()->Append(new StreamingListener(target.substr(0, pos),
target.substr(pos+1))); target.substr(pos+1)));
} else { } else {
printf("WARNING: unrecognized streaming target \"%s\" ignored.\n", GTEST_LOG_(WARNING) << "unrecognized streaming target \""
target.c_str()); << target
fflush(stdout); << "\" ignored.";
} }
} }
} }
...@@ -4550,9 +4575,9 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); } ...@@ -4550,9 +4575,9 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); }
bool UnitTestImpl::RunAllTests() { bool UnitTestImpl::RunAllTests() {
// Makes sure InitGoogleTest() was called. // Makes sure InitGoogleTest() was called.
if (!GTestIsInitialized()) { if (!GTestIsInitialized()) {
printf("%s", GTEST_LOG_(ERROR) <<
"\nThis test program did NOT call ::testing::InitGoogleTest " "\nThis test program did NOT call ::testing::InitGoogleTest "
"before calling RUN_ALL_TESTS(). Please fix it.\n"); "before calling RUN_ALL_TESTS(). Please fix it.";
return false; return false;
} }
...@@ -4783,7 +4808,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) { ...@@ -4783,7 +4808,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
// each TestCase and TestInfo object. // each TestCase and TestInfo object.
// If shard_tests == true, further filters tests based on sharding // If shard_tests == true, further filters tests based on sharding
// variables in the environment - see // variables in the environment - see
// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide. // https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md .
// Returns the number of tests that should run. // Returns the number of tests that should run.
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) { int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ? const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
...@@ -5188,7 +5213,7 @@ static const char kColorEncodedHelpMessage[] = ...@@ -5188,7 +5213,7 @@ static const char kColorEncodedHelpMessage[] =
" @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G" " @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G"
GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n" GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
" Generate an XML report in the given directory or with the given file\n" " Generate an XML report in the given directory or with the given file\n"
" name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n" " name. @YFILE_PATH@D defaults to @Gtest_detail.xml@D.\n"
#if GTEST_CAN_STREAM_RESULTS_ #if GTEST_CAN_STREAM_RESULTS_
" @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n" " @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n"
" Stream test results to the given server.\n" " Stream test results to the given server.\n"
...@@ -5252,11 +5277,9 @@ bool ParseGoogleTestFlag(const char* const arg) { ...@@ -5252,11 +5277,9 @@ bool ParseGoogleTestFlag(const char* const arg) {
void LoadFlagsFromFile(const std::string& path) { void LoadFlagsFromFile(const std::string& path) {
FILE* flagfile = posix::FOpen(path.c_str(), "r"); FILE* flagfile = posix::FOpen(path.c_str(), "r");
if (!flagfile) { if (!flagfile) {
fprintf(stderr, GTEST_LOG_(FATAL) << "Unable to open file \""
"Unable to open file \"%s\"\n", << GTEST_FLAG(flagfile)
GTEST_FLAG(flagfile).c_str()); << "\"";
fflush(stderr);
exit(EXIT_FAILURE);
} }
std::string contents(ReadEntireFile(flagfile)); std::string contents(ReadEntireFile(flagfile));
posix::FClose(flagfile); posix::FClose(flagfile);
......
# Copyright 2017 Google Inc.
# All Rights Reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Author: misterg@google.com (Gennadiy Civil)
#
# Bazel BUILD for The Google C++ Testing Framework (Google Test)
licenses(["notice"])
""" gtest own tests """
#on windows exclude gtest-tuple.h and gtest-tuple_test.cc
cc_test(
name = "gtest_all_test",
size = "small",
srcs = glob(
include = [
"gtest-*.cc",
"*.h",
"googletest/include/gtest/**/*.h",
],
exclude = [
"gtest-unittest-api_test.cc",
"gtest-tuple_test.cc",
"googletest/src/gtest-all.cc",
"gtest_all_test.cc",
"gtest-death-test_ex_test.cc",
"gtest-listener_test.cc",
"gtest-unittest-api_test.cc",
"gtest-param-test_test.cc",
],
) + select({
"//:win": [],
"//conditions:default": [
"gtest-tuple_test.cc",
],
}),
copts = select({
"//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
"//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
}),
includes = [
"googletest",
"googletest/include",
"googletest/include/internal",
"googletest/test",
],
linkopts = select({
"//:win": [],
"//conditions:default": [
"-pthread",
],
}),
deps = ["//:gtest_main"],
)
#These googletest tests have their own main()
cc_test(
name = "gtest-listener_test",
size = "small",
srcs = [
"gtest-listener_test.cc",
],
deps = [
"//:gtest",
],
)
cc_test(
name = "gtest-unittest-api_test",
size = "small",
srcs = [
"gtest-unittest-api_test.cc",
],
deps = [
"//:gtest",
],
)
cc_test(
name = "gtest-param-test_test",
size = "small",
srcs = [
"gtest-param-test2_test.cc",
"gtest-param-test_test.cc",
"gtest-param-test_test.h",
],
deps = [
"//:gtest",
],
)
...@@ -61,7 +61,7 @@ using testing::internal::AlwaysTrue; ...@@ -61,7 +61,7 @@ using testing::internal::AlwaysTrue;
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
# define GTEST_IMPLEMENTATION_ 1 # define GTEST_IMPLEMENTATION_ 1
# include "src/gtest-internal-inl.h" # include "src/gtest-internal-inl.h"
# undef GTEST_IMPLEMENTATION_ # undef GTEST_IMPLEMENTATION_
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -141,7 +141,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator, ...@@ -141,7 +141,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator,
<< ", expected_values[i] is " << PrintValue(expected_values[i]) << ", expected_values[i] is " << PrintValue(expected_values[i])
<< ", *it is " << PrintValue(*it) << ", *it is " << PrintValue(*it)
<< ", and 'it' is an iterator created with the copy constructor.\n"; << ", and 'it' is an iterator created with the copy constructor.\n";
it++; ++it;
} }
EXPECT_TRUE(it == generator.end()) EXPECT_TRUE(it == generator.end())
<< "At the presumed end of sequence when accessing via an iterator " << "At the presumed end of sequence when accessing via an iterator "
...@@ -161,7 +161,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator, ...@@ -161,7 +161,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator,
<< ", expected_values[i] is " << PrintValue(expected_values[i]) << ", expected_values[i] is " << PrintValue(expected_values[i])
<< ", *it is " << PrintValue(*it) << ", *it is " << PrintValue(*it)
<< ", and 'it' is an iterator created with the copy constructor.\n"; << ", and 'it' is an iterator created with the copy constructor.\n";
it++; ++it;
} }
EXPECT_TRUE(it == generator.end()) EXPECT_TRUE(it == generator.end())
<< "At the presumed end of sequence when accessing via an iterator " << "At the presumed end of sequence when accessing via an iterator "
...@@ -196,7 +196,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) { ...@@ -196,7 +196,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
<< "element same as its source points to"; << "element same as its source points to";
// Verifies that iterator assignment works as expected. // Verifies that iterator assignment works as expected.
it++; ++it;
EXPECT_FALSE(*it == *it2); EXPECT_FALSE(*it == *it2);
it2 = it; it2 = it;
EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the " EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the "
...@@ -215,7 +215,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) { ...@@ -215,7 +215,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
// Verifies that prefix and postfix operator++() advance an iterator // Verifies that prefix and postfix operator++() advance an iterator
// all the same. // all the same.
it2 = it; it2 = it;
it++; ++it;
++it2; ++it2;
EXPECT_TRUE(*it == *it2); EXPECT_TRUE(*it == *it2);
} }
...@@ -857,8 +857,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {} ...@@ -857,8 +857,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, INSTANTIATE_TEST_CASE_P(CustomParamNameLambda,
CustomLambdaNamingTest, CustomLambdaNamingTest,
Values(std::string("LambdaName")), Values(std::string("LambdaName")),
[](const ::testing::TestParamInfo<std::string>& info) { [](const ::testing::TestParamInfo<std::string>& tpinfo) {
return info.param; return tpinfo.param;
}); });
#endif // GTEST_LANG_CXX11 #endif // GTEST_LANG_CXX11
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
...@@ -1209,7 +1209,7 @@ class DestructorTracker { ...@@ -1209,7 +1209,7 @@ class DestructorTracker {
: index_(GetNewIndex()) {} : index_(GetNewIndex()) {}
~DestructorTracker() { ~DestructorTracker() {
// We never access DestructorCall::List() concurrently, so we don't need // We never access DestructorCall::List() concurrently, so we don't need
// to protect this acccess with a mutex. // to protect this access with a mutex.
DestructorCall::List()[index_]->ReportDestroyed(); DestructorCall::List()[index_]->ReportDestroyed();
} }
......
...@@ -51,10 +51,15 @@ ...@@ -51,10 +51,15 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
// hash_map and hash_set are available under Visual C++, or on Linux. // hash_map and hash_set are available under Visual C++, or on Linux.
#if GTEST_HAS_HASH_MAP_ #if GTEST_HAS_UNORDERED_MAP_
# include <unordered_map> // NOLINT
#elif GTEST_HAS_HASH_MAP_
# include <hash_map> // NOLINT # include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_ #endif // GTEST_HAS_HASH_MAP_
#if GTEST_HAS_HASH_SET_
#if GTEST_HAS_UNORDERED_SET_
# include <unordered_set> // NOLINT
#elif GTEST_HAS_HASH_SET_
# include <hash_set> // NOLINT # include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_ #endif // GTEST_HAS_HASH_SET_
...@@ -187,6 +192,29 @@ inline ::std::ostream& operator<<(::std::ostream& os, ...@@ -187,6 +192,29 @@ inline ::std::ostream& operator<<(::std::ostream& os,
return os << "StreamableTemplateInFoo: " << x.value(); return os << "StreamableTemplateInFoo: " << x.value();
} }
// A user-defined streamable but recursivly-defined container type in
// a user namespace, it mimics therefore std::filesystem::path or
// boost::filesystem::path.
class PathLike {
public:
struct iterator
{
typedef PathLike value_type;
};
typedef iterator const_iterator;
PathLike() {}
iterator begin() const { return iterator(); }
iterator end() const { return iterator(); }
friend
::std::ostream& operator<<(::std::ostream& os, const PathLike&)
{
return os << "Streamable-PathLike";
}
};
} // namespace foo } // namespace foo
namespace testing { namespace testing {
...@@ -216,21 +244,47 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings; ...@@ -216,21 +244,47 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
#endif #endif
using ::testing::internal::string; using ::testing::internal::string;
#if GTEST_HAS_HASH_MAP_
// The hash_* classes are not part of the C++ standard. STLport // The hash_* classes are not part of the C++ standard. STLport
// defines them in namespace std. MSVC defines them in ::stdext. GCC // defines them in namespace std. MSVC defines them in ::stdext. GCC
// defines them in ::. // defines them in ::.
#if GTEST_HAS_UNORDERED_MAP_
#define GTEST_HAS_HASH_MAP_ 1
template<class Key, class T>
using hash_map = ::std::unordered_map<Key, T>;
template<class Key, class T>
using hash_multimap = ::std::unordered_multimap<Key, T>;
#elif GTEST_HAS_HASH_MAP_
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport. #ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using ::std::hash_map; using ::std::hash_map;
using ::std::hash_set;
using ::std::hash_multimap; using ::std::hash_multimap;
using ::std::hash_multiset;
#elif _MSC_VER #elif _MSC_VER
using ::stdext::hash_map; using ::stdext::hash_map;
using ::stdext::hash_set;
using ::stdext::hash_multimap; using ::stdext::hash_multimap;
#endif
#endif
#if GTEST_HAS_UNORDERED_SET_
#define GTEST_HAS_HASH_SET_ 1
template<class Key>
using hash_set = ::std::unordered_set<Key>;
template<class Key>
using hash_multiset = ::std::unordered_multiset<Key>;
#elif GTEST_HAS_HASH_SET_
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using ::std::hash_set;
using ::std::hash_multiset;
#elif _MSC_VER
using ::stdext::hash_set;
using ::stdext::hash_multiset; using ::stdext::hash_multiset;
#endif #endif
#endif #endif
// Prints a value to a string using the universal value printer. This // Prints a value to a string using the universal value printer. This
...@@ -1038,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) { ...@@ -1038,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) {
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, testing::internal::Int64, float, double, const char*, void*,
std::string> std::string>
t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL), t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
"10"); ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
Print(t10)); Print(t10));
...@@ -1098,8 +1152,8 @@ TEST(PrintStdTupleTest, VariousSizes) { ...@@ -1098,8 +1152,8 @@ TEST(PrintStdTupleTest, VariousSizes) {
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, testing::internal::Int64, float, double, const char*, void*,
std::string> std::string>
t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL), t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
"10"); ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
Print(t10)); Print(t10));
...@@ -1161,6 +1215,15 @@ TEST(PrintStreamableTypeTest, TemplateTypeInUserNamespace) { ...@@ -1161,6 +1215,15 @@ TEST(PrintStreamableTypeTest, TemplateTypeInUserNamespace) {
Print(::foo::StreamableTemplateInFoo<int>())); Print(::foo::StreamableTemplateInFoo<int>()));
} }
// Tests printing a user-defined recursive container type that has a <<
// operator.
TEST(PrintStreamableTypeTest, PathLikeInUserNamespace) {
::foo::PathLike x;
EXPECT_EQ("Streamable-PathLike", Print(x));
const ::foo::PathLike cx;
EXPECT_EQ("Streamable-PathLike", Print(cx));
}
// Tests printing user-defined types that have a PrintTo() function. // Tests printing user-defined types that have a PrintTo() function.
TEST(PrintPrintableTypeTest, InUserNamespace) { TEST(PrintPrintableTypeTest, InUserNamespace) {
EXPECT_EQ("PrintableViaPrintTo: 0", EXPECT_EQ("PrintableViaPrintTo: 0",
......
...@@ -138,7 +138,7 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) { ...@@ -138,7 +138,7 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
} }
// Exceptions in destructors are not supported in C++11. // Exceptions in destructors are not supported in C++11.
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L && _MSC_VER < 1900 #if !GTEST_LANG_CXX11
class CxxExceptionInDestructorTest : public Test { class CxxExceptionInDestructorTest : public Test {
public: public:
static void TearDownTestCase() { static void TearDownTestCase() {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -5,8 +5,9 @@ Value of: false ...@@ -5,8 +5,9 @@ Value of: false
Actual: false Actual: false
Expected: true Expected: true
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 2 Expected equality of these values:
To be equal to: 3 2
3
[==========] Running 66 tests from 29 test cases. [==========] Running 66 tests from 29 test cases.
[----------] Global test environment set-up. [----------] Global test environment set-up.
FooEnvironment::SetUp() called. FooEnvironment::SetUp() called.
...@@ -34,21 +35,24 @@ BarEnvironment::SetUp() called. ...@@ -34,21 +35,24 @@ BarEnvironment::SetUp() called.
[----------] 2 tests from NonfatalFailureTest [----------] 2 tests from NonfatalFailureTest
[ RUN ] NonfatalFailureTest.EscapesStringOperands [ RUN ] NonfatalFailureTest.EscapesStringOperands
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: kGoldenString Expected equality of these values:
Which is: "\"Line" kGoldenString
To be equal to: actual Which is: "\"Line"
Which is: "actual \"string\"" actual
gtest_output_test_.cc:#: Failure Which is: "actual \"string\""
Expected: golden gtest_output_test_.cc:#: Failure
Which is: "\"Line" Expected equality of these values:
To be equal to: actual golden
Which is: "actual \"string\"" Which is: "\"Line"
actual
Which is: "actual \"string\""
[ FAILED ] NonfatalFailureTest.EscapesStringOperands [ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ RUN ] NonfatalFailureTest.DiffForLongStrings [ RUN ] NonfatalFailureTest.DiffForLongStrings
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: golden_str Expected equality of these values:
Which is: "\"Line\0 1\"\nLine 2" golden_str
To be equal to: "Line 2" Which is: "\"Line\0 1\"\nLine 2"
"Line 2"
With diff: With diff:
@@ -1,2 @@ @@ -1,2 @@
-\"Line\0 1\" -\"Line\0 1\"
...@@ -59,16 +63,18 @@ With diff: ...@@ -59,16 +63,18 @@ With diff:
[ RUN ] FatalFailureTest.FatalFailureInSubroutine [ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: x 1
Which is: 2 x
Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine [ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: x 1
Which is: 2 x
Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false) (expecting a failure on false)
...@@ -107,39 +113,44 @@ This failure is expected, and shouldn't have a trace. ...@@ -107,39 +113,44 @@ This failure is expected, and shouldn't have a trace.
[ RUN ] SCOPED_TRACETest.WorksInLoop [ RUN ] SCOPED_TRACETest.WorksInLoop
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 2 Expected equality of these values:
To be equal to: n 2
Which is: 1 n
Which is: 1
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: i = 1 gtest_output_test_.cc:#: i = 1
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: n 1
Which is: 2 n
Which is: 2
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: i = 2 gtest_output_test_.cc:#: i = 2
[ FAILED ] SCOPED_TRACETest.WorksInLoop [ FAILED ] SCOPED_TRACETest.WorksInLoop
[ RUN ] SCOPED_TRACETest.WorksInSubroutine [ RUN ] SCOPED_TRACETest.WorksInSubroutine
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 2 Expected equality of these values:
To be equal to: n 2
Which is: 1 n
Which is: 1
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: n = 1 gtest_output_test_.cc:#: n = 1
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: n 1
Which is: 2 n
Which is: 2
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: n = 2 gtest_output_test_.cc:#: n = 2
[ FAILED ] SCOPED_TRACETest.WorksInSubroutine [ FAILED ] SCOPED_TRACETest.WorksInSubroutine
[ RUN ] SCOPED_TRACETest.CanBeNested [ RUN ] SCOPED_TRACETest.CanBeNested
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: n 1
Which is: 2 n
Which is: 2
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: n = 2 gtest_output_test_.cc:#: n = 2
gtest_output_test_.cc:#: gtest_output_test_.cc:#:
...@@ -437,9 +448,10 @@ Expected: 1 fatal failure ...@@ -437,9 +448,10 @@ Expected: 1 fatal failure
[ OK ] TypedTest/0.Success [ OK ] TypedTest/0.Success
[ RUN ] TypedTest/0.Failure [ RUN ] TypedTest/0.Failure
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: TypeParam() 1
Which is: 0 TypeParam()
Which is: 0
Expected failure Expected failure
[ FAILED ] TypedTest/0.Failure, where TypeParam = int [ FAILED ] TypedTest/0.Failure, where TypeParam = int
[----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char [----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
...@@ -447,10 +459,11 @@ Expected failure ...@@ -447,10 +459,11 @@ Expected failure
[ OK ] Unsigned/TypedTestP/0.Success [ OK ] Unsigned/TypedTestP/0.Success
[ RUN ] Unsigned/TypedTestP/0.Failure [ RUN ] Unsigned/TypedTestP/0.Failure
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1U Expected equality of these values:
Which is: 1 1U
To be equal to: TypeParam() Which is: 1
Which is: '\0' TypeParam()
Which is: '\0'
Expected failure Expected failure
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char [ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int [----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
...@@ -458,10 +471,11 @@ Expected failure ...@@ -458,10 +471,11 @@ Expected failure
[ OK ] Unsigned/TypedTestP/1.Success [ OK ] Unsigned/TypedTestP/1.Success
[ RUN ] Unsigned/TypedTestP/1.Failure [ RUN ] Unsigned/TypedTestP/1.Failure
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1U Expected equality of these values:
Which is: 1 1U
To be equal to: TypeParam() Which is: 1
Which is: 0 TypeParam()
Which is: 0
Expected failure Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int [ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[----------] 4 tests from ExpectFailureTest [----------] 4 tests from ExpectFailureTest
...@@ -597,18 +611,20 @@ Expected non-fatal failure. ...@@ -597,18 +611,20 @@ Expected non-fatal failure.
[----------] 1 test from PrintingFailingParams/FailingParamTest [----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0 [ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: GetParam() 1
Which is: 2 GetParam()
Which is: 2
[ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2 [ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[----------] 2 tests from PrintingStrings/ParamTest [----------] 2 tests from PrintingStrings/ParamTest
[ RUN ] PrintingStrings/ParamTest.Success/a [ RUN ] PrintingStrings/ParamTest.Success/a
[ OK ] PrintingStrings/ParamTest.Success/a [ OK ] PrintingStrings/ParamTest.Success/a
[ RUN ] PrintingStrings/ParamTest.Failure/a [ RUN ] PrintingStrings/ParamTest.Failure/a
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: "b" Expected equality of these values:
To be equal to: GetParam() "b"
Which is: "a" GetParam()
Which is: "a"
Expected failure Expected failure
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a" [ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[----------] Global test environment tear-down [----------] Global test environment tear-down
...@@ -678,16 +694,18 @@ Expected fatal failure. ...@@ -678,16 +694,18 @@ Expected fatal failure.
[ RUN ] FatalFailureTest.FatalFailureInSubroutine [ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: x 1
Which is: 2 x
Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms) [ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure gtest_output_test_.cc:#: Failure
Expected: 1 Expected equality of these values:
To be equal to: x 1
Which is: 2 x
Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms) [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false) (expecting a failure on false)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment