From 1cb10b357a8a96b54ae60d4103918892f58d7fb3 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Sun, 23 Sep 2018 15:15:38 +0200 Subject: Readded changes from 6494f5232b130a29321e661166442bac324c4383 --- googletest/include/gtest/internal/gtest-internal.h | 56 ++++++++++++++++------ googletest/test/gtest_unittest.cc | 45 ++++++++++++++--- 2 files changed, 79 insertions(+), 22 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index b762f61..0dbf100 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -1189,6 +1189,19 @@ class NativeArray { GTEST_DISALLOW_ASSIGN_(NativeArray); }; +class AdditionalMessage +{ +public: + AdditionalMessage(const char* message) : value(message) {} + void set(const std::string& message) { value = message; } + operator bool() const { return true; } + + const std::string& get() const { return value; } + +private: + std::string value; +}; + } // namespace internal } // namespace testing @@ -1216,43 +1229,56 @@ class NativeArray { #define GTEST_TEST_THROW_(statement, expected_exception, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::ConstCharPtr gtest_msg = "") { \ + if (::testing::internal::AdditionalMessage message = "") { \ bool gtest_caught_expected = false; \ try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } \ + catch (expected_exception const&) { \ + gtest_caught_expected = true; \ + throw; \ + } \ } \ - catch (expected_exception const&) { \ - gtest_caught_expected = true; \ + catch (const std::exception& e) { \ + if (!gtest_caught_expected) { \ + message.set("it throws a different type " \ + "with message: " + std::string(e.what())); \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ + } \ } \ catch (...) { \ - gtest_msg.value = \ - "Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: it throws a different type."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ + if (!gtest_caught_expected) { \ + message.set("it throws a different type."); \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ + } \ } \ if (!gtest_caught_expected) { \ - gtest_msg.value = \ - "Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: it throws nothing."; \ + message.set("it throws nothing."); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \ - fail(gtest_msg.value) + fail(("Expected: " #statement " throws an exception of type " \ + #expected_exception ".\n Actual: " + message.get()).c_str()) #define GTEST_TEST_NO_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ + if (::testing::internal::AdditionalMessage message = ".") { \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ + catch (const std::exception& e) { \ + message.set(std::string(": ") + e.what()); \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ + } \ catch (...) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \ - fail("Expected: " #statement " doesn't throw an exception.\n" \ - " Actual: it throws.") + fail(("Expected: " #statement " doesn't throw an exception.\n" \ + " Actual: it throws" + message.get()).c_str()) #define GTEST_TEST_ANY_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index c03b367..6b75ab4 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -3328,6 +3328,9 @@ TEST_F(SingleEvaluationTest, OtherCases) { void ThrowAnInteger() { throw 1; } +void ThrowAnException(const char* what) { + throw std::runtime_error(what); +} // Tests that assertion arguments are evaluated exactly once. TEST_F(SingleEvaluationTest, ExceptionTests) { @@ -3370,6 +3373,20 @@ TEST_F(SingleEvaluationTest, ExceptionTests) { // failed EXPECT_ANY_THROW EXPECT_NONFATAL_FAILURE(EXPECT_ANY_THROW(a_++), "it doesn't"); EXPECT_EQ(7, a_); + + // failed EXPECT_THROW std::exception, throws different + EXPECT_NONFATAL_FAILURE(EXPECT_THROW({ // NOLINT + a_++; + ThrowAnInteger(); + }, std::exception), "throws a different type"); + EXPECT_EQ(8, a_); + + // failed EXPECT_THROW, throws std::exception + EXPECT_NONFATAL_FAILURE(EXPECT_THROW({ // NOLINT + a_++; + ThrowAnException("blablubb"); + }, bool), "throws a different type with message: blablubb"); + EXPECT_EQ(9, a_); } #endif // GTEST_HAS_EXCEPTIONS @@ -3802,6 +3819,11 @@ TEST(AssertionTest, ASSERT_THROW) { ASSERT_THROW(ThrowNothing(), bool), "Expected: ThrowNothing() throws an exception of type bool.\n" " Actual: it throws nothing."); + + EXPECT_FATAL_FAILURE( + ASSERT_THROW(ThrowAnException("buuh"), bool), + "Expected: ThrowAnException(\"buuh\") throws an exception of type bool.\n" + " Actual: it throws a different type with message: buuh"); } // Tests ASSERT_NO_THROW. @@ -3810,6 +3832,9 @@ TEST(AssertionTest, ASSERT_NO_THROW) { EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnInteger()), "Expected: ThrowAnInteger() doesn't throw an exception." "\n Actual: it throws."); + EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnException("blablubb")), + "Expected: ThrowAnException(\"blablubb\") doesn't throw an exception." + "\n Actual: it throws: blablubb"); } // Tests ASSERT_ANY_THROW. @@ -4536,13 +4561,16 @@ TEST(ExpectTest, EXPECT_GT) { // Tests EXPECT_THROW. TEST(ExpectTest, EXPECT_THROW) { EXPECT_THROW(ThrowAnInteger(), int); + EXPECT_THROW(ThrowAnException(""), std::exception); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnInteger(), bool), - "Expected: ThrowAnInteger() throws an exception of " - "type bool.\n Actual: it throws a different type."); - EXPECT_NONFATAL_FAILURE( - EXPECT_THROW(ThrowNothing(), bool), - "Expected: ThrowNothing() throws an exception of type bool.\n" - " Actual: it throws nothing."); + "Expected: ThrowAnInteger() throws an exception of type bool.\n" + " Actual: it throws a different type."); + EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowNothing(), bool), + "Expected: ThrowNothing() throws an exception of type bool.\n" + " Actual: it throws nothing."); + EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnException("buuh"), bool), + "Expected: ThrowAnException(\"buuh\") throws an exception of type bool.\n" + " Actual: it throws a different type with message: buuh"); } // Tests EXPECT_NO_THROW. @@ -4551,6 +4579,9 @@ TEST(ExpectTest, EXPECT_NO_THROW) { EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnInteger()), "Expected: ThrowAnInteger() doesn't throw an " "exception.\n Actual: it throws."); + EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnException("blablubb")), + "Expected: ThrowAnException(\"blablubb\") doesn't throw an " + "exception.\n Actual: it throws: blablubb"); } // Tests EXPECT_ANY_THROW. @@ -6826,7 +6857,7 @@ TEST(ColoredOutputTest, UsesColorsWhenStdoutIsTty) { TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) { GTEST_FLAG(color) = "auto"; -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW +#if GTEST_OS_WINDOWS // On Windows, we ignore the TERM variable as it's usually not set. SetEnv("TERM", "dumb"); -- cgit v0.12 From cecea92af84a978479a9d875500edf0ee7b8aef3 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Sun, 23 Sep 2018 15:46:47 +0200 Subject: Rename private member of AdditionalMessage Shorten lines in unit tests --- googletest/include/gtest/internal/gtest-internal.h | 8 +++--- googletest/test/gtest_unittest.cc | 29 +++++++++++----------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 0dbf100..7a896ab 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -1192,14 +1192,14 @@ class NativeArray { class AdditionalMessage { public: - AdditionalMessage(const char* message) : value(message) {} - void set(const std::string& message) { value = message; } + AdditionalMessage(const char* message) : msg(message) {} + void set(const std::string& message) { msg = message; } operator bool() const { return true; } - const std::string& get() const { return value; } + const std::string& get() const { return msg; } private: - std::string value; + std::string msg; }; } // namespace internal diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 6b75ab4..721e0cb 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -3821,9 +3821,9 @@ TEST(AssertionTest, ASSERT_THROW) { " Actual: it throws nothing."); EXPECT_FATAL_FAILURE( - ASSERT_THROW(ThrowAnException("buuh"), bool), - "Expected: ThrowAnException(\"buuh\") throws an exception of type bool.\n" - " Actual: it throws a different type with message: buuh"); + ASSERT_THROW(ThrowAnException("b"), bool), + "Expected: ThrowAnException(\"b\") throws an exception of type bool.\n" + " Actual: it throws a different type with message: b"); } // Tests ASSERT_NO_THROW. @@ -3833,8 +3833,8 @@ TEST(AssertionTest, ASSERT_NO_THROW) { "Expected: ThrowAnInteger() doesn't throw an exception." "\n Actual: it throws."); EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnException("blablubb")), - "Expected: ThrowAnException(\"blablubb\") doesn't throw an exception." - "\n Actual: it throws: blablubb"); + "Expected: ThrowAnException(\"blablubb\") doesn't throw" + "an exception.\n Actual: it throws: blablubb"); } // Tests ASSERT_ANY_THROW. @@ -4563,14 +4563,15 @@ TEST(ExpectTest, EXPECT_THROW) { EXPECT_THROW(ThrowAnInteger(), int); EXPECT_THROW(ThrowAnException(""), std::exception); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnInteger(), bool), - "Expected: ThrowAnInteger() throws an exception of type bool.\n" - " Actual: it throws a different type."); + "Expected: ThrowAnInteger() throws an exception of " + "type bool.\n Actual: it throws a different type."); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowNothing(), bool), - "Expected: ThrowNothing() throws an exception of type bool.\n" - " Actual: it throws nothing."); + "Expected: ThrowNothing() throws an exception of " + "type bool.\n Actual: it throws nothing."); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnException("buuh"), bool), - "Expected: ThrowAnException(\"buuh\") throws an exception of type bool.\n" - " Actual: it throws a different type with message: buuh"); + "Expected: ThrowAnException(\"buuh\") throws an " + "exception of type bool.\n Actual: " + "it throws a different type with message: buuh"); } // Tests EXPECT_NO_THROW. @@ -4579,9 +4580,9 @@ TEST(ExpectTest, EXPECT_NO_THROW) { EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnInteger()), "Expected: ThrowAnInteger() doesn't throw an " "exception.\n Actual: it throws."); - EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnException("blablubb")), - "Expected: ThrowAnException(\"blablubb\") doesn't throw an " - "exception.\n Actual: it throws: blablubb"); + EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(ThrowAnException("blah")), + "Expected: ThrowAnException(\"blah\") doesn't " + "throw an exception.\n Actual: it throws: blah"); } // Tests EXPECT_ANY_THROW. -- cgit v0.12 From 2b2b8d71c176c51bfd81ab1df7d174adbd29ff4f Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Sun, 23 Sep 2018 15:50:29 +0200 Subject: Fix ColoredOutputTest.UsesColorsWhenTermSupportsColors again --- googletest/test/gtest_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 721e0cb..a5d0df7 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -6858,7 +6858,7 @@ TEST(ColoredOutputTest, UsesColorsWhenStdoutIsTty) { TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) { GTEST_FLAG(color) = "auto"; -#if GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW // On Windows, we ignore the TERM variable as it's usually not set. SetEnv("TERM", "dumb"); -- cgit v0.12 From 67d3c0f6d77067a82aee5134525be4d54a3a62fc Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Sun, 23 Sep 2018 16:39:13 +0200 Subject: Fix unit test --- googletest/test/gtest_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index a5d0df7..a001cfa 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -3834,7 +3834,7 @@ TEST(AssertionTest, ASSERT_NO_THROW) { "\n Actual: it throws."); EXPECT_FATAL_FAILURE(ASSERT_NO_THROW(ThrowAnException("blablubb")), "Expected: ThrowAnException(\"blablubb\") doesn't throw" - "an exception.\n Actual: it throws: blablubb"); + " an exception.\n Actual: it throws: blablubb"); } // Tests ASSERT_ANY_THROW. -- cgit v0.12 From 78d3bfeb4432ced6e3c6b9689b60f90c4114bf35 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 09:34:47 -0700 Subject: Formatting --- googletest/include/gtest/internal/gtest-internal.h | 125 +++++++++++---------- 1 file changed, 64 insertions(+), 61 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 7a896ab..ca42b06 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -32,12 +32,14 @@ // This header file declares functions and macros used internally by // Google Test. They are subject to change without notice. -// GOOGLETEST_CM0001 DO NOT DELETE +// IWYU pragma: private, include "testing/base/public/gunit.h" +// IWYU pragma: friend third_party/googletest/googletest/.* +// IWYU pragma: friend third_party/googletest/googlemock/.* #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ -#include "gtest/internal/gtest-port.h" +#include "third_party/googletest/googletest/include/gtest/internal/gtest-port.h" #if GTEST_OS_LINUX # include @@ -60,10 +62,10 @@ #include #include -#include "gtest/gtest-message.h" -#include "gtest/internal/gtest-filepath.h" -#include "gtest/internal/gtest-string.h" -#include "gtest/internal/gtest-type-util.h" +#include "third_party/googletest/googletest/include/gtest/gtest-message.h" +#include "third_party/googletest/googletest/include/gtest/internal/gtest-filepath.h" +#include "third_party/googletest/googletest/include/gtest/internal/gtest-string.h" +#include "third_party/googletest/googletest/include/gtest/internal/gtest-type-util.h" // Due to C++ preprocessor weirdness, we need double indirection to // concatenate two tokens when one of them is __LINE__. Writing @@ -752,7 +754,7 @@ class TypeParameterizedTestCase { // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by -// the gtest_stack_trace_depth flag. The skip_count parameter +// the gunit_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // @@ -1189,16 +1191,15 @@ class NativeArray { GTEST_DISALLOW_ASSIGN_(NativeArray); }; -class AdditionalMessage -{ -public: +class AdditionalMessage { + public: AdditionalMessage(const char* message) : msg(message) {} void set(const std::string& message) { msg = message; } operator bool() const { return true; } const std::string& get() const { return msg; } -private: + private: std::string msg; }; @@ -1227,58 +1228,60 @@ private: #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ if (::testing::internal::AlwaysTrue()) { statement; } -#define GTEST_TEST_THROW_(statement, expected_exception, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AdditionalMessage message = "") { \ - bool gtest_caught_expected = false; \ - try { \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (expected_exception const&) { \ - gtest_caught_expected = true; \ - throw; \ - } \ - } \ - catch (const std::exception& e) { \ - if (!gtest_caught_expected) { \ - message.set("it throws a different type " \ - "with message: " + std::string(e.what())); \ +#define GTEST_TEST_THROW_(statement, expected_exception, fail) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AdditionalMessage message = "") { \ + bool gtest_caught_expected = false; \ + try { \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } catch (expected_exception const&) { \ + gtest_caught_expected = true; \ + throw; \ + } \ + } catch (const std::exception& e) { \ + if (!gtest_caught_expected) { \ + message.set( \ + "it throws a different type " \ + "with message: " + \ + std::string(e.what())); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - } \ - catch (...) { \ - if (!gtest_caught_expected) { \ - message.set("it throws a different type."); \ + } \ + } catch (...) { \ + if (!gtest_caught_expected) { \ + message.set("it throws a different type."); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - } \ - if (!gtest_caught_expected) { \ - message.set("it throws nothing."); \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \ - fail(("Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: " + message.get()).c_str()) - -#define GTEST_TEST_NO_THROW_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AdditionalMessage message = ".") { \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (const std::exception& e) { \ - message.set(std::string(": ") + e.what()); \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ - } \ - catch (...) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \ - fail(("Expected: " #statement " doesn't throw an exception.\n" \ - " Actual: it throws" + message.get()).c_str()) + } \ + } \ + if (!gtest_caught_expected) { \ + message.set("it throws nothing."); \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ + } \ + } else \ + GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__) \ + : fail(("Expected: " #statement \ + " throws an exception of type " #expected_exception \ + ".\n Actual: " + \ + message.get()) \ + .c_str()) + +#define GTEST_TEST_NO_THROW_(statement, fail) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AdditionalMessage message = ".") { \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } catch (const std::exception& e) { \ + message.set(std::string(": ") + e.what()); \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ + } catch (...) { \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ + } \ + } else \ + GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__) \ + : fail(("Expected: " #statement " doesn't throw an exception.\n" \ + " Actual: it throws" + \ + message.get()) \ + .c_str()) #define GTEST_TEST_ANY_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ -- cgit v0.12 From 529338370757d20bf0aae40dd4a9033e18cdd5df Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 09:35:25 -0700 Subject: Formatting --- googletest/test/gtest_unittest.cc | 232 +++++++++++++++++++------------------- 1 file changed, 118 insertions(+), 114 deletions(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index a001cfa..72ba27b 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -31,7 +31,7 @@ // Tests for Google Test itself. This verifies that the basic constructs of // Google Test work. -#include "gtest/gtest.h" +#include "third_party/googletest/googletest/include/gtest/gtest.h" // Verifies that the command line flag variables can be accessed in // code once "gtest.h" has been #included. @@ -65,8 +65,8 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { #include #include -#include "gtest/gtest-spi.h" -#include "src/gtest-internal-inl.h" +#include "third_party/googletest/googletest/include/gtest/gtest-spi.h" +#include "third_party/googletest/googletest/src/gtest-internal-inl.h" namespace testing { namespace internal { @@ -3328,9 +3328,7 @@ TEST_F(SingleEvaluationTest, OtherCases) { void ThrowAnInteger() { throw 1; } -void ThrowAnException(const char* what) { - throw std::runtime_error(what); -} +void ThrowAnException(const char* what) { throw std::runtime_error(what); } // Tests that assertion arguments are evaluated exactly once. TEST_F(SingleEvaluationTest, ExceptionTests) { @@ -3375,17 +3373,23 @@ TEST_F(SingleEvaluationTest, ExceptionTests) { EXPECT_EQ(7, a_); // failed EXPECT_THROW std::exception, throws different - EXPECT_NONFATAL_FAILURE(EXPECT_THROW({ // NOLINT - a_++; - ThrowAnInteger(); - }, std::exception), "throws a different type"); + EXPECT_NONFATAL_FAILURE(EXPECT_THROW( + { // NOLINT + a_++; + ThrowAnInteger(); + }, + std::exception), + "throws a different type"); EXPECT_EQ(8, a_); // failed EXPECT_THROW, throws std::exception - EXPECT_NONFATAL_FAILURE(EXPECT_THROW({ // NOLINT - a_++; - ThrowAnException("blablubb"); - }, bool), "throws a different type with message: blablubb"); + EXPECT_NONFATAL_FAILURE(EXPECT_THROW( + { // NOLINT + a_++; + ThrowAnException("blablubb"); + }, + bool), + "throws a different type with message: blablubb"); EXPECT_EQ(9, a_); } @@ -4566,10 +4570,10 @@ TEST(ExpectTest, EXPECT_THROW) { "Expected: ThrowAnInteger() throws an exception of " "type bool.\n Actual: it throws a different type."); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowNothing(), bool), - "Expected: ThrowNothing() throws an exception of " + "Expected: ThrowNothing() throws an exception of " "type bool.\n Actual: it throws nothing."); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(ThrowAnException("buuh"), bool), - "Expected: ThrowAnException(\"buuh\") throws an " + "Expected: ThrowAnException(\"buuh\") throws an " "exception of type bool.\n Actual: " "it throws a different type with message: buuh"); } @@ -5531,7 +5535,7 @@ struct Flags { // Factory methods. - // Creates a Flags struct where the gtest_also_run_disabled_tests flag has + // Creates a Flags struct where the gunit_also_run_disabled_tests flag has // the given value. static Flags AlsoRunDisabledTests(bool also_run_disabled_tests) { Flags flags; @@ -5539,7 +5543,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_break_on_failure flag has + // Creates a Flags struct where the gunit_break_on_failure flag has // the given value. static Flags BreakOnFailure(bool break_on_failure) { Flags flags; @@ -5547,7 +5551,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_catch_exceptions flag has + // Creates a Flags struct where the gunit_catch_exceptions flag has // the given value. static Flags CatchExceptions(bool catch_exceptions) { Flags flags; @@ -5555,7 +5559,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_death_test_use_fork flag has + // Creates a Flags struct where the gunit_death_test_use_fork flag has // the given value. static Flags DeathTestUseFork(bool death_test_use_fork) { Flags flags; @@ -5563,7 +5567,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_filter flag has the given + // Creates a Flags struct where the gunit_filter flag has the given // value. static Flags Filter(const char* filter) { Flags flags; @@ -5571,7 +5575,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_list_tests flag has the + // Creates a Flags struct where the gunit_list_tests flag has the // given value. static Flags ListTests(bool list_tests) { Flags flags; @@ -5579,7 +5583,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_output flag has the given + // Creates a Flags struct where the gunit_output flag has the given // value. static Flags Output(const char* output) { Flags flags; @@ -5587,7 +5591,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_print_time flag has the given + // Creates a Flags struct where the gunit_print_time flag has the given // value. static Flags PrintTime(bool print_time) { Flags flags; @@ -5595,7 +5599,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_random_seed flag has the given + // Creates a Flags struct where the gunit_random_seed flag has the given // value. static Flags RandomSeed(Int32 random_seed) { Flags flags; @@ -5603,7 +5607,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_repeat flag has the given + // Creates a Flags struct where the gunit_repeat flag has the given // value. static Flags Repeat(Int32 repeat) { Flags flags; @@ -5611,7 +5615,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_shuffle flag has the given + // Creates a Flags struct where the gunit_shuffle flag has the given // value. static Flags Shuffle(bool shuffle) { Flags flags; @@ -5635,7 +5639,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gtest_throw_on_failure flag has + // Creates a Flags struct where the gunit_throw_on_failure flag has // the given value. static Flags ThrowOnFailure(bool throw_on_failure) { Flags flags; @@ -5795,28 +5799,28 @@ TEST_F(ParseFlagsTest, NoFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false); } -// Tests parsing a bad --gtest_filter flag. +// Tests parsing a bad --gunit_filter flag. TEST_F(ParseFlagsTest, FilterBad) { const char* argv[] = { "foo.exe", - "--gtest_filter", + "--gunit_filter", NULL }; const char* argv2[] = { "foo.exe", - "--gtest_filter", + "--gunit_filter", NULL }; GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true); } -// Tests parsing an empty --gtest_filter flag. +// Tests parsing an empty --gunit_filter flag. TEST_F(ParseFlagsTest, FilterEmpty) { const char* argv[] = { "foo.exe", - "--gtest_filter=", + "--gunit_filter=", NULL }; @@ -5828,11 +5832,11 @@ TEST_F(ParseFlagsTest, FilterEmpty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), false); } -// Tests parsing a non-empty --gtest_filter flag. +// Tests parsing a non-empty --gunit_filter flag. TEST_F(ParseFlagsTest, FilterNonEmpty) { const char* argv[] = { "foo.exe", - "--gtest_filter=abc", + "--gunit_filter=abc", NULL }; @@ -5844,11 +5848,11 @@ TEST_F(ParseFlagsTest, FilterNonEmpty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"), false); } -// Tests parsing --gtest_break_on_failure. +// Tests parsing --gunit_break_on_failure. TEST_F(ParseFlagsTest, BreakOnFailureWithoutValue) { const char* argv[] = { "foo.exe", - "--gtest_break_on_failure", + "--gunit_break_on_failure", NULL }; @@ -5860,11 +5864,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureWithoutValue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false); } -// Tests parsing --gtest_break_on_failure=0. +// Tests parsing --gunit_break_on_failure=0. TEST_F(ParseFlagsTest, BreakOnFailureFalse_0) { const char* argv[] = { "foo.exe", - "--gtest_break_on_failure=0", + "--gunit_break_on_failure=0", NULL }; @@ -5876,11 +5880,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureFalse_0) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false); } -// Tests parsing --gtest_break_on_failure=f. +// Tests parsing --gunit_break_on_failure=f. TEST_F(ParseFlagsTest, BreakOnFailureFalse_f) { const char* argv[] = { "foo.exe", - "--gtest_break_on_failure=f", + "--gunit_break_on_failure=f", NULL }; @@ -5892,11 +5896,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureFalse_f) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false); } -// Tests parsing --gtest_break_on_failure=F. +// Tests parsing --gunit_break_on_failure=F. TEST_F(ParseFlagsTest, BreakOnFailureFalse_F) { const char* argv[] = { "foo.exe", - "--gtest_break_on_failure=F", + "--gunit_break_on_failure=F", NULL }; @@ -5908,12 +5912,12 @@ TEST_F(ParseFlagsTest, BreakOnFailureFalse_F) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false); } -// Tests parsing a --gtest_break_on_failure flag that has a "true" +// Tests parsing a --gunit_break_on_failure flag that has a "true" // definition. TEST_F(ParseFlagsTest, BreakOnFailureTrue) { const char* argv[] = { "foo.exe", - "--gtest_break_on_failure=1", + "--gunit_break_on_failure=1", NULL }; @@ -5925,11 +5929,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false); } -// Tests parsing --gtest_catch_exceptions. +// Tests parsing --gunit_catch_exceptions. TEST_F(ParseFlagsTest, CatchExceptions) { const char* argv[] = { "foo.exe", - "--gtest_catch_exceptions", + "--gunit_catch_exceptions", NULL }; @@ -5941,11 +5945,11 @@ TEST_F(ParseFlagsTest, CatchExceptions) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::CatchExceptions(true), false); } -// Tests parsing --gtest_death_test_use_fork. +// Tests parsing --gunit_death_test_use_fork. TEST_F(ParseFlagsTest, DeathTestUseFork) { const char* argv[] = { "foo.exe", - "--gtest_death_test_use_fork", + "--gunit_death_test_use_fork", NULL }; @@ -5962,8 +5966,8 @@ TEST_F(ParseFlagsTest, DeathTestUseFork) { TEST_F(ParseFlagsTest, DuplicatedFlags) { const char* argv[] = { "foo.exe", - "--gtest_filter=a", - "--gtest_filter=b", + "--gunit_filter=a", + "--gunit_filter=b", NULL }; @@ -5979,9 +5983,9 @@ TEST_F(ParseFlagsTest, DuplicatedFlags) { TEST_F(ParseFlagsTest, UnrecognizedFlag) { const char* argv[] = { "foo.exe", - "--gtest_break_on_failure", + "--gunit_break_on_failure", "bar", // Unrecognized by Google Test. - "--gtest_filter=b", + "--gunit_filter=b", NULL }; @@ -5997,11 +6001,11 @@ TEST_F(ParseFlagsTest, UnrecognizedFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, flags, false); } -// Tests having a --gtest_list_tests flag +// Tests having a --gunit_list_tests flag TEST_F(ParseFlagsTest, ListTestsFlag) { const char* argv[] = { "foo.exe", - "--gtest_list_tests", + "--gunit_list_tests", NULL }; @@ -6013,11 +6017,11 @@ TEST_F(ParseFlagsTest, ListTestsFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false); } -// Tests having a --gtest_list_tests flag with a "true" value +// Tests having a --gunit_list_tests flag with a "true" value TEST_F(ParseFlagsTest, ListTestsTrue) { const char* argv[] = { "foo.exe", - "--gtest_list_tests=1", + "--gunit_list_tests=1", NULL }; @@ -6029,11 +6033,11 @@ TEST_F(ParseFlagsTest, ListTestsTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false); } -// Tests having a --gtest_list_tests flag with a "false" value +// Tests having a --gunit_list_tests flag with a "false" value TEST_F(ParseFlagsTest, ListTestsFalse) { const char* argv[] = { "foo.exe", - "--gtest_list_tests=0", + "--gunit_list_tests=0", NULL }; @@ -6045,11 +6049,11 @@ TEST_F(ParseFlagsTest, ListTestsFalse) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false); } -// Tests parsing --gtest_list_tests=f. +// Tests parsing --gunit_list_tests=f. TEST_F(ParseFlagsTest, ListTestsFalse_f) { const char* argv[] = { "foo.exe", - "--gtest_list_tests=f", + "--gunit_list_tests=f", NULL }; @@ -6061,11 +6065,11 @@ TEST_F(ParseFlagsTest, ListTestsFalse_f) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false); } -// Tests parsing --gtest_list_tests=F. +// Tests parsing --gunit_list_tests=F. TEST_F(ParseFlagsTest, ListTestsFalse_F) { const char* argv[] = { "foo.exe", - "--gtest_list_tests=F", + "--gunit_list_tests=F", NULL }; @@ -6077,28 +6081,28 @@ TEST_F(ParseFlagsTest, ListTestsFalse_F) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false); } -// Tests parsing --gtest_output (invalid). +// Tests parsing --gunit_output (invalid). TEST_F(ParseFlagsTest, OutputEmpty) { const char* argv[] = { "foo.exe", - "--gtest_output", + "--gunit_output", NULL }; const char* argv2[] = { "foo.exe", - "--gtest_output", + "--gunit_output", NULL }; GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true); } -// Tests parsing --gtest_output=xml +// Tests parsing --gunit_output=xml TEST_F(ParseFlagsTest, OutputXml) { const char* argv[] = { "foo.exe", - "--gtest_output=xml", + "--gunit_output=xml", NULL }; @@ -6110,11 +6114,11 @@ TEST_F(ParseFlagsTest, OutputXml) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml"), false); } -// Tests parsing --gtest_output=xml:file +// Tests parsing --gunit_output=xml:file TEST_F(ParseFlagsTest, OutputXmlFile) { const char* argv[] = { "foo.exe", - "--gtest_output=xml:file", + "--gunit_output=xml:file", NULL }; @@ -6126,11 +6130,11 @@ TEST_F(ParseFlagsTest, OutputXmlFile) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml:file"), false); } -// Tests parsing --gtest_output=xml:directory/path/ +// Tests parsing --gunit_output=xml:directory/path/ TEST_F(ParseFlagsTest, OutputXmlDirectory) { const char* argv[] = { "foo.exe", - "--gtest_output=xml:directory/path/", + "--gunit_output=xml:directory/path/", NULL }; @@ -6143,11 +6147,11 @@ TEST_F(ParseFlagsTest, OutputXmlDirectory) { Flags::Output("xml:directory/path/"), false); } -// Tests having a --gtest_print_time flag +// Tests having a --gunit_print_time flag TEST_F(ParseFlagsTest, PrintTimeFlag) { const char* argv[] = { "foo.exe", - "--gtest_print_time", + "--gunit_print_time", NULL }; @@ -6159,11 +6163,11 @@ TEST_F(ParseFlagsTest, PrintTimeFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false); } -// Tests having a --gtest_print_time flag with a "true" value +// Tests having a --gunit_print_time flag with a "true" value TEST_F(ParseFlagsTest, PrintTimeTrue) { const char* argv[] = { "foo.exe", - "--gtest_print_time=1", + "--gunit_print_time=1", NULL }; @@ -6175,11 +6179,11 @@ TEST_F(ParseFlagsTest, PrintTimeTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false); } -// Tests having a --gtest_print_time flag with a "false" value +// Tests having a --gunit_print_time flag with a "false" value TEST_F(ParseFlagsTest, PrintTimeFalse) { const char* argv[] = { "foo.exe", - "--gtest_print_time=0", + "--gunit_print_time=0", NULL }; @@ -6191,11 +6195,11 @@ TEST_F(ParseFlagsTest, PrintTimeFalse) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false); } -// Tests parsing --gtest_print_time=f. +// Tests parsing --gunit_print_time=f. TEST_F(ParseFlagsTest, PrintTimeFalse_f) { const char* argv[] = { "foo.exe", - "--gtest_print_time=f", + "--gunit_print_time=f", NULL }; @@ -6207,11 +6211,11 @@ TEST_F(ParseFlagsTest, PrintTimeFalse_f) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false); } -// Tests parsing --gtest_print_time=F. +// Tests parsing --gunit_print_time=F. TEST_F(ParseFlagsTest, PrintTimeFalse_F) { const char* argv[] = { "foo.exe", - "--gtest_print_time=F", + "--gunit_print_time=F", NULL }; @@ -6223,11 +6227,11 @@ TEST_F(ParseFlagsTest, PrintTimeFalse_F) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false); } -// Tests parsing --gtest_random_seed=number +// Tests parsing --gunit_random_seed=number TEST_F(ParseFlagsTest, RandomSeed) { const char* argv[] = { "foo.exe", - "--gtest_random_seed=1000", + "--gunit_random_seed=1000", NULL }; @@ -6239,11 +6243,11 @@ TEST_F(ParseFlagsTest, RandomSeed) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::RandomSeed(1000), false); } -// Tests parsing --gtest_repeat=number +// Tests parsing --gunit_repeat=number TEST_F(ParseFlagsTest, Repeat) { const char* argv[] = { "foo.exe", - "--gtest_repeat=1000", + "--gunit_repeat=1000", NULL }; @@ -6255,11 +6259,11 @@ TEST_F(ParseFlagsTest, Repeat) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Repeat(1000), false); } -// Tests having a --gtest_also_run_disabled_tests flag +// Tests having a --gunit_also_run_disabled_tests flag TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFlag) { const char* argv[] = { "foo.exe", - "--gtest_also_run_disabled_tests", + "--gunit_also_run_disabled_tests", NULL }; @@ -6272,11 +6276,11 @@ TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFlag) { Flags::AlsoRunDisabledTests(true), false); } -// Tests having a --gtest_also_run_disabled_tests flag with a "true" value +// Tests having a --gunit_also_run_disabled_tests flag with a "true" value TEST_F(ParseFlagsTest, AlsoRunDisabledTestsTrue) { const char* argv[] = { "foo.exe", - "--gtest_also_run_disabled_tests=1", + "--gunit_also_run_disabled_tests=1", NULL }; @@ -6289,11 +6293,11 @@ TEST_F(ParseFlagsTest, AlsoRunDisabledTestsTrue) { Flags::AlsoRunDisabledTests(true), false); } -// Tests having a --gtest_also_run_disabled_tests flag with a "false" value +// Tests having a --gunit_also_run_disabled_tests flag with a "false" value TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFalse) { const char* argv[] = { "foo.exe", - "--gtest_also_run_disabled_tests=0", + "--gunit_also_run_disabled_tests=0", NULL }; @@ -6306,11 +6310,11 @@ TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFalse) { Flags::AlsoRunDisabledTests(false), false); } -// Tests parsing --gtest_shuffle. +// Tests parsing --gunit_shuffle. TEST_F(ParseFlagsTest, ShuffleWithoutValue) { const char* argv[] = { "foo.exe", - "--gtest_shuffle", + "--gunit_shuffle", NULL }; @@ -6322,11 +6326,11 @@ TEST_F(ParseFlagsTest, ShuffleWithoutValue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false); } -// Tests parsing --gtest_shuffle=0. +// Tests parsing --gunit_shuffle=0. TEST_F(ParseFlagsTest, ShuffleFalse_0) { const char* argv[] = { "foo.exe", - "--gtest_shuffle=0", + "--gunit_shuffle=0", NULL }; @@ -6338,11 +6342,11 @@ TEST_F(ParseFlagsTest, ShuffleFalse_0) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(false), false); } -// Tests parsing a --gtest_shuffle flag that has a "true" definition. +// Tests parsing a --gunit_shuffle flag that has a "true" definition. TEST_F(ParseFlagsTest, ShuffleTrue) { const char* argv[] = { "foo.exe", - "--gtest_shuffle=1", + "--gunit_shuffle=1", NULL }; @@ -6354,11 +6358,11 @@ TEST_F(ParseFlagsTest, ShuffleTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false); } -// Tests parsing --gtest_stack_trace_depth=number. +// Tests parsing --gunit_stack_trace_depth=number. TEST_F(ParseFlagsTest, StackTraceDepth) { const char* argv[] = { "foo.exe", - "--gtest_stack_trace_depth=5", + "--gunit_stack_trace_depth=5", NULL }; @@ -6373,7 +6377,7 @@ TEST_F(ParseFlagsTest, StackTraceDepth) { TEST_F(ParseFlagsTest, StreamResultTo) { const char* argv[] = { "foo.exe", - "--gtest_stream_result_to=localhost:1234", + "--gunit_stream_result_to=localhost:1234", NULL }; @@ -6386,11 +6390,11 @@ TEST_F(ParseFlagsTest, StreamResultTo) { argv, argv2, Flags::StreamResultTo("localhost:1234"), false); } -// Tests parsing --gtest_throw_on_failure. +// Tests parsing --gunit_throw_on_failure. TEST_F(ParseFlagsTest, ThrowOnFailureWithoutValue) { const char* argv[] = { "foo.exe", - "--gtest_throw_on_failure", + "--gunit_throw_on_failure", NULL }; @@ -6402,11 +6406,11 @@ TEST_F(ParseFlagsTest, ThrowOnFailureWithoutValue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(true), false); } -// Tests parsing --gtest_throw_on_failure=0. +// Tests parsing --gunit_throw_on_failure=0. TEST_F(ParseFlagsTest, ThrowOnFailureFalse_0) { const char* argv[] = { "foo.exe", - "--gtest_throw_on_failure=0", + "--gunit_throw_on_failure=0", NULL }; @@ -6418,12 +6422,12 @@ TEST_F(ParseFlagsTest, ThrowOnFailureFalse_0) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(false), false); } -// Tests parsing a --gtest_throw_on_failure flag that has a "true" +// Tests parsing a --gunit_throw_on_failure flag that has a "true" // definition. TEST_F(ParseFlagsTest, ThrowOnFailureTrue) { const char* argv[] = { "foo.exe", - "--gtest_throw_on_failure=1", + "--gunit_throw_on_failure=1", NULL }; @@ -6440,16 +6444,16 @@ TEST_F(ParseFlagsTest, ThrowOnFailureTrue) { TEST_F(ParseFlagsTest, WideStrings) { const wchar_t* argv[] = { L"foo.exe", - L"--gtest_filter=Foo*", - L"--gtest_list_tests=1", - L"--gtest_break_on_failure", - L"--non_gtest_flag", + L"--gunit_filter=Foo*", + L"--gunit_list_tests=1", + L"--gunit_break_on_failure", + L"--non_gunit_flag", NULL }; const wchar_t* argv2[] = { L"foo.exe", - L"--non_gtest_flag", + L"--non_gunit_flag", NULL }; @@ -6513,7 +6517,7 @@ TEST_F(FlagfileTest, Empty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false); } -// Tests passing a non-empty --gtest_filter flag via --gtest_flagfile. +// Tests passing a non-empty --gunit_filter flag via --gunit_flagfile. TEST_F(FlagfileTest, FilterNonEmpty) { internal::FilePath flagfile_path(CreateFlagfile( "--" GTEST_FLAG_PREFIX_ "filter=abc")); @@ -6534,7 +6538,7 @@ TEST_F(FlagfileTest, FilterNonEmpty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"), false); } -// Tests passing several flags via --gtest_flagfile. +// Tests passing several flags via --gunit_flagfile. TEST_F(FlagfileTest, SeveralFlags) { internal::FilePath flagfile_path(CreateFlagfile( "--" GTEST_FLAG_PREFIX_ "filter=abc\n" -- cgit v0.12 From 659647110426889c003d54c471f3d7c8df633ab4 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 09:41:12 -0700 Subject: Formatting --- googletest/include/gtest/internal/gtest-internal.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index ca42b06..4dcc587 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -32,14 +32,12 @@ // This header file declares functions and macros used internally by // Google Test. They are subject to change without notice. -// IWYU pragma: private, include "testing/base/public/gunit.h" -// IWYU pragma: friend third_party/googletest/googletest/.* -// IWYU pragma: friend third_party/googletest/googlemock/.* +// GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ -#include "third_party/googletest/googletest/include/gtest/internal/gtest-port.h" +#include "gtest/internal/gtest-port.h" #if GTEST_OS_LINUX # include @@ -62,10 +60,10 @@ #include #include -#include "third_party/googletest/googletest/include/gtest/gtest-message.h" -#include "third_party/googletest/googletest/include/gtest/internal/gtest-filepath.h" -#include "third_party/googletest/googletest/include/gtest/internal/gtest-string.h" -#include "third_party/googletest/googletest/include/gtest/internal/gtest-type-util.h" +#include "gtest/gtest-message.h" +#include "gtest/internal/gtest-filepath.h" +#include "gtest/internal/gtest-string.h" +#include "gtest/internal/gtest-type-util.h" // Due to C++ preprocessor weirdness, we need double indirection to // concatenate two tokens when one of them is __LINE__. Writing @@ -754,7 +752,7 @@ class TypeParameterizedTestCase { // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by -// the gunit_stack_trace_depth flag. The skip_count parameter +// the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // -- cgit v0.12 From 81c0b876b4fc919eb0056ec1465d88971101d8ea Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 09:42:11 -0700 Subject: Formatting --- googletest/test/gtest_unittest.cc | 202 +++++++++++++++++++------------------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 72ba27b..f2c4435 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -31,7 +31,7 @@ // Tests for Google Test itself. This verifies that the basic constructs of // Google Test work. -#include "third_party/googletest/googletest/include/gtest/gtest.h" +#include "gtest/gtest.h" // Verifies that the command line flag variables can be accessed in // code once "gtest.h" has been #included. @@ -65,8 +65,8 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { #include #include -#include "third_party/googletest/googletest/include/gtest/gtest-spi.h" -#include "third_party/googletest/googletest/src/gtest-internal-inl.h" +#include "gtest/gtest-spi.h" +#include "src/gtest-internal-inl.h" namespace testing { namespace internal { @@ -5535,7 +5535,7 @@ struct Flags { // Factory methods. - // Creates a Flags struct where the gunit_also_run_disabled_tests flag has + // Creates a Flags struct where the gtest_also_run_disabled_tests flag has // the given value. static Flags AlsoRunDisabledTests(bool also_run_disabled_tests) { Flags flags; @@ -5543,7 +5543,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_break_on_failure flag has + // Creates a Flags struct where the gtest_break_on_failure flag has // the given value. static Flags BreakOnFailure(bool break_on_failure) { Flags flags; @@ -5551,7 +5551,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_catch_exceptions flag has + // Creates a Flags struct where the gtest_catch_exceptions flag has // the given value. static Flags CatchExceptions(bool catch_exceptions) { Flags flags; @@ -5559,7 +5559,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_death_test_use_fork flag has + // Creates a Flags struct where the gtest_death_test_use_fork flag has // the given value. static Flags DeathTestUseFork(bool death_test_use_fork) { Flags flags; @@ -5567,7 +5567,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_filter flag has the given + // Creates a Flags struct where the gtest_filter flag has the given // value. static Flags Filter(const char* filter) { Flags flags; @@ -5575,7 +5575,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_list_tests flag has the + // Creates a Flags struct where the gtest_list_tests flag has the // given value. static Flags ListTests(bool list_tests) { Flags flags; @@ -5583,7 +5583,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_output flag has the given + // Creates a Flags struct where the gtest_output flag has the given // value. static Flags Output(const char* output) { Flags flags; @@ -5591,7 +5591,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_print_time flag has the given + // Creates a Flags struct where the gtest_print_time flag has the given // value. static Flags PrintTime(bool print_time) { Flags flags; @@ -5599,7 +5599,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_random_seed flag has the given + // Creates a Flags struct where the gtest_random_seed flag has the given // value. static Flags RandomSeed(Int32 random_seed) { Flags flags; @@ -5607,7 +5607,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_repeat flag has the given + // Creates a Flags struct where the gtest_repeat flag has the given // value. static Flags Repeat(Int32 repeat) { Flags flags; @@ -5615,7 +5615,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_shuffle flag has the given + // Creates a Flags struct where the gtest_shuffle flag has the given // value. static Flags Shuffle(bool shuffle) { Flags flags; @@ -5639,7 +5639,7 @@ struct Flags { return flags; } - // Creates a Flags struct where the gunit_throw_on_failure flag has + // Creates a Flags struct where the gtest_throw_on_failure flag has // the given value. static Flags ThrowOnFailure(bool throw_on_failure) { Flags flags; @@ -5799,28 +5799,28 @@ TEST_F(ParseFlagsTest, NoFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false); } -// Tests parsing a bad --gunit_filter flag. +// Tests parsing a bad --gtest_filter flag. TEST_F(ParseFlagsTest, FilterBad) { const char* argv[] = { "foo.exe", - "--gunit_filter", + "--gtest_filter", NULL }; const char* argv2[] = { "foo.exe", - "--gunit_filter", + "--gtest_filter", NULL }; GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true); } -// Tests parsing an empty --gunit_filter flag. +// Tests parsing an empty --gtest_filter flag. TEST_F(ParseFlagsTest, FilterEmpty) { const char* argv[] = { "foo.exe", - "--gunit_filter=", + "--gtest_filter=", NULL }; @@ -5832,11 +5832,11 @@ TEST_F(ParseFlagsTest, FilterEmpty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), false); } -// Tests parsing a non-empty --gunit_filter flag. +// Tests parsing a non-empty --gtest_filter flag. TEST_F(ParseFlagsTest, FilterNonEmpty) { const char* argv[] = { "foo.exe", - "--gunit_filter=abc", + "--gtest_filter=abc", NULL }; @@ -5848,11 +5848,11 @@ TEST_F(ParseFlagsTest, FilterNonEmpty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"), false); } -// Tests parsing --gunit_break_on_failure. +// Tests parsing --gtest_break_on_failure. TEST_F(ParseFlagsTest, BreakOnFailureWithoutValue) { const char* argv[] = { "foo.exe", - "--gunit_break_on_failure", + "--gtest_break_on_failure", NULL }; @@ -5864,11 +5864,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureWithoutValue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false); } -// Tests parsing --gunit_break_on_failure=0. +// Tests parsing --gtest_break_on_failure=0. TEST_F(ParseFlagsTest, BreakOnFailureFalse_0) { const char* argv[] = { "foo.exe", - "--gunit_break_on_failure=0", + "--gtest_break_on_failure=0", NULL }; @@ -5880,11 +5880,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureFalse_0) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false); } -// Tests parsing --gunit_break_on_failure=f. +// Tests parsing --gtest_break_on_failure=f. TEST_F(ParseFlagsTest, BreakOnFailureFalse_f) { const char* argv[] = { "foo.exe", - "--gunit_break_on_failure=f", + "--gtest_break_on_failure=f", NULL }; @@ -5896,11 +5896,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureFalse_f) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false); } -// Tests parsing --gunit_break_on_failure=F. +// Tests parsing --gtest_break_on_failure=F. TEST_F(ParseFlagsTest, BreakOnFailureFalse_F) { const char* argv[] = { "foo.exe", - "--gunit_break_on_failure=F", + "--gtest_break_on_failure=F", NULL }; @@ -5912,12 +5912,12 @@ TEST_F(ParseFlagsTest, BreakOnFailureFalse_F) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false), false); } -// Tests parsing a --gunit_break_on_failure flag that has a "true" +// Tests parsing a --gtest_break_on_failure flag that has a "true" // definition. TEST_F(ParseFlagsTest, BreakOnFailureTrue) { const char* argv[] = { "foo.exe", - "--gunit_break_on_failure=1", + "--gtest_break_on_failure=1", NULL }; @@ -5929,11 +5929,11 @@ TEST_F(ParseFlagsTest, BreakOnFailureTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true), false); } -// Tests parsing --gunit_catch_exceptions. +// Tests parsing --gtest_catch_exceptions. TEST_F(ParseFlagsTest, CatchExceptions) { const char* argv[] = { "foo.exe", - "--gunit_catch_exceptions", + "--gtest_catch_exceptions", NULL }; @@ -5945,11 +5945,11 @@ TEST_F(ParseFlagsTest, CatchExceptions) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::CatchExceptions(true), false); } -// Tests parsing --gunit_death_test_use_fork. +// Tests parsing --gtest_death_test_use_fork. TEST_F(ParseFlagsTest, DeathTestUseFork) { const char* argv[] = { "foo.exe", - "--gunit_death_test_use_fork", + "--gtest_death_test_use_fork", NULL }; @@ -5966,8 +5966,8 @@ TEST_F(ParseFlagsTest, DeathTestUseFork) { TEST_F(ParseFlagsTest, DuplicatedFlags) { const char* argv[] = { "foo.exe", - "--gunit_filter=a", - "--gunit_filter=b", + "--gtest_filter=a", + "--gtest_filter=b", NULL }; @@ -5983,9 +5983,9 @@ TEST_F(ParseFlagsTest, DuplicatedFlags) { TEST_F(ParseFlagsTest, UnrecognizedFlag) { const char* argv[] = { "foo.exe", - "--gunit_break_on_failure", + "--gtest_break_on_failure", "bar", // Unrecognized by Google Test. - "--gunit_filter=b", + "--gtest_filter=b", NULL }; @@ -6001,11 +6001,11 @@ TEST_F(ParseFlagsTest, UnrecognizedFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, flags, false); } -// Tests having a --gunit_list_tests flag +// Tests having a --gtest_list_tests flag TEST_F(ParseFlagsTest, ListTestsFlag) { const char* argv[] = { "foo.exe", - "--gunit_list_tests", + "--gtest_list_tests", NULL }; @@ -6017,11 +6017,11 @@ TEST_F(ParseFlagsTest, ListTestsFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false); } -// Tests having a --gunit_list_tests flag with a "true" value +// Tests having a --gtest_list_tests flag with a "true" value TEST_F(ParseFlagsTest, ListTestsTrue) { const char* argv[] = { "foo.exe", - "--gunit_list_tests=1", + "--gtest_list_tests=1", NULL }; @@ -6033,11 +6033,11 @@ TEST_F(ParseFlagsTest, ListTestsTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true), false); } -// Tests having a --gunit_list_tests flag with a "false" value +// Tests having a --gtest_list_tests flag with a "false" value TEST_F(ParseFlagsTest, ListTestsFalse) { const char* argv[] = { "foo.exe", - "--gunit_list_tests=0", + "--gtest_list_tests=0", NULL }; @@ -6049,11 +6049,11 @@ TEST_F(ParseFlagsTest, ListTestsFalse) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false); } -// Tests parsing --gunit_list_tests=f. +// Tests parsing --gtest_list_tests=f. TEST_F(ParseFlagsTest, ListTestsFalse_f) { const char* argv[] = { "foo.exe", - "--gunit_list_tests=f", + "--gtest_list_tests=f", NULL }; @@ -6065,11 +6065,11 @@ TEST_F(ParseFlagsTest, ListTestsFalse_f) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false); } -// Tests parsing --gunit_list_tests=F. +// Tests parsing --gtest_list_tests=F. TEST_F(ParseFlagsTest, ListTestsFalse_F) { const char* argv[] = { "foo.exe", - "--gunit_list_tests=F", + "--gtest_list_tests=F", NULL }; @@ -6081,28 +6081,28 @@ TEST_F(ParseFlagsTest, ListTestsFalse_F) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false), false); } -// Tests parsing --gunit_output (invalid). +// Tests parsing --gtest_output (invalid). TEST_F(ParseFlagsTest, OutputEmpty) { const char* argv[] = { "foo.exe", - "--gunit_output", + "--gtest_output", NULL }; const char* argv2[] = { "foo.exe", - "--gunit_output", + "--gtest_output", NULL }; GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true); } -// Tests parsing --gunit_output=xml +// Tests parsing --gtest_output=xml TEST_F(ParseFlagsTest, OutputXml) { const char* argv[] = { "foo.exe", - "--gunit_output=xml", + "--gtest_output=xml", NULL }; @@ -6114,11 +6114,11 @@ TEST_F(ParseFlagsTest, OutputXml) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml"), false); } -// Tests parsing --gunit_output=xml:file +// Tests parsing --gtest_output=xml:file TEST_F(ParseFlagsTest, OutputXmlFile) { const char* argv[] = { "foo.exe", - "--gunit_output=xml:file", + "--gtest_output=xml:file", NULL }; @@ -6130,11 +6130,11 @@ TEST_F(ParseFlagsTest, OutputXmlFile) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml:file"), false); } -// Tests parsing --gunit_output=xml:directory/path/ +// Tests parsing --gtest_output=xml:directory/path/ TEST_F(ParseFlagsTest, OutputXmlDirectory) { const char* argv[] = { "foo.exe", - "--gunit_output=xml:directory/path/", + "--gtest_output=xml:directory/path/", NULL }; @@ -6147,11 +6147,11 @@ TEST_F(ParseFlagsTest, OutputXmlDirectory) { Flags::Output("xml:directory/path/"), false); } -// Tests having a --gunit_print_time flag +// Tests having a --gtest_print_time flag TEST_F(ParseFlagsTest, PrintTimeFlag) { const char* argv[] = { "foo.exe", - "--gunit_print_time", + "--gtest_print_time", NULL }; @@ -6163,11 +6163,11 @@ TEST_F(ParseFlagsTest, PrintTimeFlag) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false); } -// Tests having a --gunit_print_time flag with a "true" value +// Tests having a --gtest_print_time flag with a "true" value TEST_F(ParseFlagsTest, PrintTimeTrue) { const char* argv[] = { "foo.exe", - "--gunit_print_time=1", + "--gtest_print_time=1", NULL }; @@ -6179,11 +6179,11 @@ TEST_F(ParseFlagsTest, PrintTimeTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true), false); } -// Tests having a --gunit_print_time flag with a "false" value +// Tests having a --gtest_print_time flag with a "false" value TEST_F(ParseFlagsTest, PrintTimeFalse) { const char* argv[] = { "foo.exe", - "--gunit_print_time=0", + "--gtest_print_time=0", NULL }; @@ -6195,11 +6195,11 @@ TEST_F(ParseFlagsTest, PrintTimeFalse) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false); } -// Tests parsing --gunit_print_time=f. +// Tests parsing --gtest_print_time=f. TEST_F(ParseFlagsTest, PrintTimeFalse_f) { const char* argv[] = { "foo.exe", - "--gunit_print_time=f", + "--gtest_print_time=f", NULL }; @@ -6211,11 +6211,11 @@ TEST_F(ParseFlagsTest, PrintTimeFalse_f) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false); } -// Tests parsing --gunit_print_time=F. +// Tests parsing --gtest_print_time=F. TEST_F(ParseFlagsTest, PrintTimeFalse_F) { const char* argv[] = { "foo.exe", - "--gunit_print_time=F", + "--gtest_print_time=F", NULL }; @@ -6227,11 +6227,11 @@ TEST_F(ParseFlagsTest, PrintTimeFalse_F) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false), false); } -// Tests parsing --gunit_random_seed=number +// Tests parsing --gtest_random_seed=number TEST_F(ParseFlagsTest, RandomSeed) { const char* argv[] = { "foo.exe", - "--gunit_random_seed=1000", + "--gtest_random_seed=1000", NULL }; @@ -6243,11 +6243,11 @@ TEST_F(ParseFlagsTest, RandomSeed) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::RandomSeed(1000), false); } -// Tests parsing --gunit_repeat=number +// Tests parsing --gtest_repeat=number TEST_F(ParseFlagsTest, Repeat) { const char* argv[] = { "foo.exe", - "--gunit_repeat=1000", + "--gtest_repeat=1000", NULL }; @@ -6259,11 +6259,11 @@ TEST_F(ParseFlagsTest, Repeat) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Repeat(1000), false); } -// Tests having a --gunit_also_run_disabled_tests flag +// Tests having a --gtest_also_run_disabled_tests flag TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFlag) { const char* argv[] = { "foo.exe", - "--gunit_also_run_disabled_tests", + "--gtest_also_run_disabled_tests", NULL }; @@ -6276,11 +6276,11 @@ TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFlag) { Flags::AlsoRunDisabledTests(true), false); } -// Tests having a --gunit_also_run_disabled_tests flag with a "true" value +// Tests having a --gtest_also_run_disabled_tests flag with a "true" value TEST_F(ParseFlagsTest, AlsoRunDisabledTestsTrue) { const char* argv[] = { "foo.exe", - "--gunit_also_run_disabled_tests=1", + "--gtest_also_run_disabled_tests=1", NULL }; @@ -6293,11 +6293,11 @@ TEST_F(ParseFlagsTest, AlsoRunDisabledTestsTrue) { Flags::AlsoRunDisabledTests(true), false); } -// Tests having a --gunit_also_run_disabled_tests flag with a "false" value +// Tests having a --gtest_also_run_disabled_tests flag with a "false" value TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFalse) { const char* argv[] = { "foo.exe", - "--gunit_also_run_disabled_tests=0", + "--gtest_also_run_disabled_tests=0", NULL }; @@ -6310,11 +6310,11 @@ TEST_F(ParseFlagsTest, AlsoRunDisabledTestsFalse) { Flags::AlsoRunDisabledTests(false), false); } -// Tests parsing --gunit_shuffle. +// Tests parsing --gtest_shuffle. TEST_F(ParseFlagsTest, ShuffleWithoutValue) { const char* argv[] = { "foo.exe", - "--gunit_shuffle", + "--gtest_shuffle", NULL }; @@ -6326,11 +6326,11 @@ TEST_F(ParseFlagsTest, ShuffleWithoutValue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false); } -// Tests parsing --gunit_shuffle=0. +// Tests parsing --gtest_shuffle=0. TEST_F(ParseFlagsTest, ShuffleFalse_0) { const char* argv[] = { "foo.exe", - "--gunit_shuffle=0", + "--gtest_shuffle=0", NULL }; @@ -6342,11 +6342,11 @@ TEST_F(ParseFlagsTest, ShuffleFalse_0) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(false), false); } -// Tests parsing a --gunit_shuffle flag that has a "true" definition. +// Tests parsing a --gtest_shuffle flag that has a "true" definition. TEST_F(ParseFlagsTest, ShuffleTrue) { const char* argv[] = { "foo.exe", - "--gunit_shuffle=1", + "--gtest_shuffle=1", NULL }; @@ -6358,11 +6358,11 @@ TEST_F(ParseFlagsTest, ShuffleTrue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Shuffle(true), false); } -// Tests parsing --gunit_stack_trace_depth=number. +// Tests parsing --gtest_stack_trace_depth=number. TEST_F(ParseFlagsTest, StackTraceDepth) { const char* argv[] = { "foo.exe", - "--gunit_stack_trace_depth=5", + "--gtest_stack_trace_depth=5", NULL }; @@ -6377,7 +6377,7 @@ TEST_F(ParseFlagsTest, StackTraceDepth) { TEST_F(ParseFlagsTest, StreamResultTo) { const char* argv[] = { "foo.exe", - "--gunit_stream_result_to=localhost:1234", + "--gtest_stream_result_to=localhost:1234", NULL }; @@ -6390,11 +6390,11 @@ TEST_F(ParseFlagsTest, StreamResultTo) { argv, argv2, Flags::StreamResultTo("localhost:1234"), false); } -// Tests parsing --gunit_throw_on_failure. +// Tests parsing --gtest_throw_on_failure. TEST_F(ParseFlagsTest, ThrowOnFailureWithoutValue) { const char* argv[] = { "foo.exe", - "--gunit_throw_on_failure", + "--gtest_throw_on_failure", NULL }; @@ -6406,11 +6406,11 @@ TEST_F(ParseFlagsTest, ThrowOnFailureWithoutValue) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(true), false); } -// Tests parsing --gunit_throw_on_failure=0. +// Tests parsing --gtest_throw_on_failure=0. TEST_F(ParseFlagsTest, ThrowOnFailureFalse_0) { const char* argv[] = { "foo.exe", - "--gunit_throw_on_failure=0", + "--gtest_throw_on_failure=0", NULL }; @@ -6422,12 +6422,12 @@ TEST_F(ParseFlagsTest, ThrowOnFailureFalse_0) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ThrowOnFailure(false), false); } -// Tests parsing a --gunit_throw_on_failure flag that has a "true" +// Tests parsing a --gtest_throw_on_failure flag that has a "true" // definition. TEST_F(ParseFlagsTest, ThrowOnFailureTrue) { const char* argv[] = { "foo.exe", - "--gunit_throw_on_failure=1", + "--gtest_throw_on_failure=1", NULL }; @@ -6444,16 +6444,16 @@ TEST_F(ParseFlagsTest, ThrowOnFailureTrue) { TEST_F(ParseFlagsTest, WideStrings) { const wchar_t* argv[] = { L"foo.exe", - L"--gunit_filter=Foo*", - L"--gunit_list_tests=1", - L"--gunit_break_on_failure", - L"--non_gunit_flag", + L"--gtest_filter=Foo*", + L"--gtest_list_tests=1", + L"--gtest_break_on_failure", + L"--non_gtest_flag", NULL }; const wchar_t* argv2[] = { L"foo.exe", - L"--non_gunit_flag", + L"--non_gtest_flag", NULL }; @@ -6517,7 +6517,7 @@ TEST_F(FlagfileTest, Empty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), false); } -// Tests passing a non-empty --gunit_filter flag via --gunit_flagfile. +// Tests passing a non-empty --gtest_filter flag via --gtest_flagfile. TEST_F(FlagfileTest, FilterNonEmpty) { internal::FilePath flagfile_path(CreateFlagfile( "--" GTEST_FLAG_PREFIX_ "filter=abc")); @@ -6538,7 +6538,7 @@ TEST_F(FlagfileTest, FilterNonEmpty) { GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"), false); } -// Tests passing several flags via --gunit_flagfile. +// Tests passing several flags via --gtest_flagfile. TEST_F(FlagfileTest, SeveralFlags) { internal::FilePath flagfile_path(CreateFlagfile( "--" GTEST_FLAG_PREFIX_ "filter=abc\n" -- cgit v0.12 From a2f13308c89cab27d924c67b6f035bcce3a8588f Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 12:05:21 -0700 Subject: Add .clang-format --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..5b9bfe6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,4 @@ +# Run manually to reformat a file: +# clang-format -i --style=file +Language: Cpp +BasedOnStyle: Google -- cgit v0.12 From 51945d3cd52f1be4b10661ec7a445423a6c354c8 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 12:07:25 -0700 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9804960..adadf55 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ package (as described below): * GNU-compatible Make or gmake * POSIX-standard shell * POSIX(-2) Regular Expressions (regex.h) - * A C++98-standard-compliant compiler + * A C++11-standard-compliant compiler ### Windows Requirements ### -- cgit v0.12 From c7a429a6677c975879ce04385fd58b4ac694004f Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Sun, 23 Sep 2018 12:10:08 -0700 Subject: Update CONTRIBUTING.md --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 846dd8a..b52f8ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,7 +78,8 @@ itself is a valuable contribution. To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected -to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). +to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). +Use [.clang-format](https://github.com/google/googletest/blob/master/.clang-format) to check your formatting ## Requirements for Contributors ### -- cgit v0.12 From 2d3466be4785560cfc93680e28f9afb92e656665 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 25 Sep 2018 02:42:15 -0400 Subject: Add clang format check to one of the builds to provide indication that formatting is incorrect --- .travis.yml | 4 +++- ci/test-format.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 ci/test-format.sh diff --git a/.travis.yml b/.travis.yml index 4ec239f..d1fe6eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,9 @@ matrix: - os: linux compiler: clang sudo : true + env: TEST_CLANG_FORMAT="yes" install: ./ci/install-linux.sh && ./ci/log-config.sh - script: ./ci/build-linux-bazel.sh + script: ./ci/test_format.sh && ./ci/build-linux-bazel.sh - os: linux group: deprecated-2017Q4 compiler: gcc @@ -65,6 +66,7 @@ addons: packages: - g++-4.9 - clang-3.9 + - clang-format-3.9 notifications: email: false diff --git a/ci/test-format.sh b/ci/test-format.sh new file mode 100755 index 0000000..502c84c --- /dev/null +++ b/ci/test-format.sh @@ -0,0 +1,33 @@ +#!/bin/bash +echo "clang-format - checking Code Formatting..." + +if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && \ + [[ "${TEST_CLANG_FORMAT}" == "yes" ]]; then + + RETURN=0 + CLANG_FORMAT="clang-format-3.9" + + which clang-format-3.9 + + if [ ! -f ".clang-format" ]; then + echo ".clang-format file not found!" + exit 1 + fi + + FILES=`git diff master --name-only | grep -E "\.(cc|cpp|h)$"` + + for FILE in $FILES; do + + $CLANG_FORMAT $FILE | cmp $FILE >/dev/null + + if [ $? -ne 0 ]; then + echo "[!] Clang-Format Found INCORRECT FORMATTING. Please re-format and re-submit. The following file failed: $FILE" >&2 + RETURN=1 + fi + + done + + exit $RETURN +fi + +exit 0 -- cgit v0.12 From 76e1045729e2cb0c2050dec056cba5eccd7d9ca5 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 25 Sep 2018 02:55:08 -0400 Subject: typo --- ci/test-format.sh | 33 --------------------------------- ci/test_format.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100755 ci/test-format.sh create mode 100755 ci/test_format.sh diff --git a/ci/test-format.sh b/ci/test-format.sh deleted file mode 100755 index 502c84c..0000000 --- a/ci/test-format.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -echo "clang-format - checking Code Formatting..." - -if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && \ - [[ "${TEST_CLANG_FORMAT}" == "yes" ]]; then - - RETURN=0 - CLANG_FORMAT="clang-format-3.9" - - which clang-format-3.9 - - if [ ! -f ".clang-format" ]; then - echo ".clang-format file not found!" - exit 1 - fi - - FILES=`git diff master --name-only | grep -E "\.(cc|cpp|h)$"` - - for FILE in $FILES; do - - $CLANG_FORMAT $FILE | cmp $FILE >/dev/null - - if [ $? -ne 0 ]; then - echo "[!] Clang-Format Found INCORRECT FORMATTING. Please re-format and re-submit. The following file failed: $FILE" >&2 - RETURN=1 - fi - - done - - exit $RETURN -fi - -exit 0 diff --git a/ci/test_format.sh b/ci/test_format.sh new file mode 100755 index 0000000..502c84c --- /dev/null +++ b/ci/test_format.sh @@ -0,0 +1,33 @@ +#!/bin/bash +echo "clang-format - checking Code Formatting..." + +if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && \ + [[ "${TEST_CLANG_FORMAT}" == "yes" ]]; then + + RETURN=0 + CLANG_FORMAT="clang-format-3.9" + + which clang-format-3.9 + + if [ ! -f ".clang-format" ]; then + echo ".clang-format file not found!" + exit 1 + fi + + FILES=`git diff master --name-only | grep -E "\.(cc|cpp|h)$"` + + for FILE in $FILES; do + + $CLANG_FORMAT $FILE | cmp $FILE >/dev/null + + if [ $? -ne 0 ]; then + echo "[!] Clang-Format Found INCORRECT FORMATTING. Please re-format and re-submit. The following file failed: $FILE" >&2 + RETURN=1 + fi + + done + + exit $RETURN +fi + +exit 0 -- cgit v0.12