diff options
author | Gennadiy Civil <misterg@google.com> | 2018-01-23 17:33:54 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-01-23 17:33:54 (GMT) |
commit | 80defcec57cecc637e9fdfe0160e122f890eed54 (patch) | |
tree | 831c59280c0bcfa28afdf57fab14396e30cf8018 | |
parent | 58df5760569ffe17bcc492465f8cd57008840039 (diff) | |
download | googletest-80defcec57cecc637e9fdfe0160e122f890eed54.zip googletest-80defcec57cecc637e9fdfe0160e122f890eed54.tar.gz googletest-80defcec57cecc637e9fdfe0160e122f890eed54.tar.bz2 |
Many code merge/upstream changes
-rw-r--r-- | googletest/src/gtest_main.cc | 2 | ||||
-rw-r--r-- | googletest/test/gtest-param-test2_test.cc | 2 | ||||
-rw-r--r-- | googletest/test/gtest-param-test_test.cc | 49 | ||||
-rw-r--r-- | googletest/test/gtest-printers_test.cc | 8 | ||||
-rw-r--r-- | googletest/test/gtest-typed-test2_test.cc | 2 | ||||
-rw-r--r-- | googletest/test/gtest-typed-test_test.cc | 2 | ||||
-rwxr-xr-x | googletest/test/gtest_break_on_failure_unittest.py | 4 | ||||
-rwxr-xr-x | googletest/test/gtest_catch_exceptions_test.py | 2 | ||||
-rwxr-xr-x | googletest/test/gtest_color_test.py | 2 | ||||
-rwxr-xr-x | googletest/test/gtest_env_var_test.py | 4 | ||||
-rwxr-xr-x | googletest/test/gtest_list_tests_unittest.py | 4 | ||||
-rw-r--r-- | googletest/test/gtest_output_test_.cc | 10 | ||||
-rw-r--r-- | googletest/test/gtest_output_test_golden_lin.txt | 27 | ||||
-rw-r--r-- | googletest/test/gtest_pred_impl_unittest.cc | 2 | ||||
-rw-r--r-- | googletest/test/gtest_prod_test.cc | 4 | ||||
-rwxr-xr-x | googletest/test/gtest_xml_test_utils.py | 4 |
16 files changed, 93 insertions, 35 deletions
diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc index f302822..5e9c94c 100644 --- a/googletest/src/gtest_main.cc +++ b/googletest/src/gtest_main.cc @@ -26,9 +26,9 @@ // 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. +// #include <stdio.h> - #include "gtest/gtest.h" GTEST_API_ int main(int argc, char **argv) { diff --git a/googletest/test/gtest-param-test2_test.cc b/googletest/test/gtest-param-test2_test.cc index fdea125..c3b2d18 100644 --- a/googletest/test/gtest-param-test2_test.cc +++ b/googletest/test/gtest-param-test2_test.cc @@ -33,7 +33,7 @@ // Google Test work. #include "gtest/gtest.h" -#include "test/gtest-param-test_test.h" +#include "gtest-param-test_test.h" using ::testing::Values; using ::testing::internal::ParamGenerator; diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index b0aa4f9..60bdfea 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -41,8 +41,8 @@ # include <sstream> # include <string> # include <vector> -# include "src/gtest-internal-inl.h" // for UnitTestOptions +# include "src/gtest-internal-inl.h" // for UnitTestOptions # include "test/gtest-param-test_test.h" using ::std::vector; @@ -536,6 +536,48 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) { VerifyGenerator(gen, expected_values); } +class NonDefaultConstructAssignString { + public: + NonDefaultConstructAssignString(const std::string& str) : str_(str) {} + + const std::string& str() const { return str_; } + + private: + std::string str_; + + // Not default constructible + NonDefaultConstructAssignString(); + // Not assignable + void operator=(const NonDefaultConstructAssignString&); +}; + +TEST(CombineTest, NonDefaultConstructAssign) { + const ParamGenerator<tuple<int, NonDefaultConstructAssignString>> gen = + Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"), + NonDefaultConstructAssignString("B"))); + + ParamGenerator<tuple<int, NonDefaultConstructAssignString>>::iterator it = + gen.begin(); + + EXPECT_EQ(0, std::get<0>(*it)); + EXPECT_EQ("A", std::get<1>(*it).str()); + ++it; + + EXPECT_EQ(0, std::get<0>(*it)); + EXPECT_EQ("B", std::get<1>(*it).str()); + ++it; + + EXPECT_EQ(1, std::get<0>(*it)); + EXPECT_EQ("A", std::get<1>(*it).str()); + ++it; + + EXPECT_EQ(1, std::get<0>(*it)); + EXPECT_EQ("B", std::get<1>(*it).str()); + ++it; + + EXPECT_TRUE(it == gen.end()); +} + # endif // GTEST_HAS_COMBINE // Tests that an generator produces correct sequence after being @@ -851,8 +893,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {} INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, CustomLambdaNamingTest, Values(std::string("LambdaName")), - [](const ::testing::TestParamInfo<std::string>& tpinfo) { - return tpinfo.param; + [](const ::testing::TestParamInfo<std::string>& info) { + return info.param; }); #endif // GTEST_LANG_CXX11 @@ -1019,6 +1061,7 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) { INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5)); + int main(int argc, char **argv) { // Used in TestGenerationTest test case. AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance()); diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index 70ac9c5..aff97a2 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -275,11 +275,11 @@ 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; +using ::std::hash_map; +using ::std::hash_multimap; #elif _MSC_VER -using ::stdext::hash_set; -using ::stdext::hash_multiset; +using ::stdext::hash_map; +using ::stdext::hash_multimap; #endif #endif diff --git a/googletest/test/gtest-typed-test2_test.cc b/googletest/test/gtest-typed-test2_test.cc index c284700..ad77c65 100644 --- a/googletest/test/gtest-typed-test2_test.cc +++ b/googletest/test/gtest-typed-test2_test.cc @@ -31,7 +31,7 @@ #include <vector> -#include "test/gtest-typed-test_test.h" +#include "gtest-typed-test_test.h" #include "gtest/gtest.h" #if GTEST_HAS_TYPED_TEST_P diff --git a/googletest/test/gtest-typed-test_test.cc b/googletest/test/gtest-typed-test_test.cc index 93628ba..5e1b7b2 100644 --- a/googletest/test/gtest-typed-test_test.cc +++ b/googletest/test/gtest-typed-test_test.cc @@ -29,7 +29,7 @@ // // Author: wan@google.com (Zhanyong Wan) -#include "test/gtest-typed-test_test.h" +#include "gtest-typed-test_test.h" #include <set> #include <vector> diff --git a/googletest/test/gtest_break_on_failure_unittest.py b/googletest/test/gtest_break_on_failure_unittest.py index 78f3e0f..16e19db 100755 --- a/googletest/test/gtest_break_on_failure_unittest.py +++ b/googletest/test/gtest_break_on_failure_unittest.py @@ -40,10 +40,8 @@ Google Test) with different environments and command line flags. __author__ = 'wan@google.com (Zhanyong Wan)' -import gtest_test_utils import os -import sys - +import gtest_test_utils # Constants. diff --git a/googletest/test/gtest_catch_exceptions_test.py b/googletest/test/gtest_catch_exceptions_test.py index e6fc22f..760f914 100755 --- a/googletest/test/gtest_catch_exceptions_test.py +++ b/googletest/test/gtest_catch_exceptions_test.py @@ -37,8 +37,6 @@ Google Test) and verifies their output. __author__ = 'vladl@google.com (Vlad Losev)' -import os - import gtest_test_utils # Constants. diff --git a/googletest/test/gtest_color_test.py b/googletest/test/gtest_color_test.py index 7d3e888..49b8ed2 100755 --- a/googletest/test/gtest_color_test.py +++ b/googletest/test/gtest_color_test.py @@ -36,7 +36,7 @@ __author__ = 'wan@google.com (Zhanyong Wan)' import os import gtest_test_utils -IS_WINDOWS = os.name = 'nt' +IS_WINDOWS = os.name == 'nt' COLOR_ENV_VAR = 'GTEST_COLOR' COLOR_FLAG = 'gtest_color' diff --git a/googletest/test/gtest_env_var_test.py b/googletest/test/gtest_env_var_test.py index 424075c..7af00ce 100755 --- a/googletest/test/gtest_env_var_test.py +++ b/googletest/test/gtest_env_var_test.py @@ -47,8 +47,8 @@ environ = os.environ.copy() def AssertEq(expected, actual): if expected != actual: - print('Expected: %s' % (expected,)) - print(' Actual: %s' % (actual,)) + print 'Expected: %s' % (expected,) + print ' Actual: %s' % (actual,) raise AssertionError diff --git a/googletest/test/gtest_list_tests_unittest.py b/googletest/test/gtest_list_tests_unittest.py index f2d2fd1..ebf1a3c 100755 --- a/googletest/test/gtest_list_tests_unittest.py +++ b/googletest/test/gtest_list_tests_unittest.py @@ -39,9 +39,8 @@ Google Test) the command line flags. __author__ = 'phanna@google.com (Patrick Hanna)' -import gtest_test_utils import re - +import gtest_test_utils # Constants. @@ -123,6 +122,7 @@ def Run(args): # The unit test. + class GTestListTestsUnitTest(gtest_test_utils.TestCase): """Tests using the --gtest_list_tests flag to list all tests.""" diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index 04ca5e5..9ae9dc6 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -168,6 +168,16 @@ void SubWithTrace(int n) { SubWithoutTrace(n); } +TEST(SCOPED_TRACETest, AcceptedValues) { + SCOPED_TRACE("literal string"); + SCOPED_TRACE(std::string("std::string")); + SCOPED_TRACE(1337); // streamable type + const char* null_value = NULL; + SCOPED_TRACE(null_value); + + ADD_FAILURE() << "Just checking that all these values work fine."; +} + // Tests that SCOPED_TRACE() obeys lexical scopes. TEST(SCOPED_TRACETest, ObeysScopes) { printf("(expected to fail)\n"); diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/gtest_output_test_golden_lin.txt index 48f5593..cbcb720 100644 --- a/googletest/test/gtest_output_test_golden_lin.txt +++ b/googletest/test/gtest_output_test_golden_lin.txt @@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure Expected equality of these values: 2 3 -[0;32m[==========] [mRunning 67 tests from 30 test cases. +[0;32m[==========] [mRunning 68 tests from 30 test cases. [0;32m[----------] [mGlobal test environment set-up. FooEnvironment::SetUp() called. BarEnvironment::SetUp() called. @@ -95,7 +95,17 @@ i == 3 gtest_output_test_.cc:#: Failure Expected: (3) >= (a[i]), actual: 3 vs 6 [0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions -[0;32m[----------] [m6 tests from SCOPED_TRACETest +[0;32m[----------] [m7 tests from SCOPED_TRACETest +[0;32m[ RUN ] [mSCOPED_TRACETest.AcceptedValues +gtest_output_test_.cc:#: Failure +Failed +Just checking that all these values work fine. +Google Test trace: +gtest_output_test_.cc:#: (null) +gtest_output_test_.cc:#: 1337 +gtest_output_test_.cc:#: std::string +gtest_output_test_.cc:#: literal string +[0;31m[ FAILED ] [mSCOPED_TRACETest.AcceptedValues [0;32m[ RUN ] [mSCOPED_TRACETest.ObeysScopes (expected to fail) gtest_output_test_.cc:#: Failure @@ -474,7 +484,7 @@ Expected equality of these values: Which is: '\0' Expected failure [0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char -[0;32m[----------] [m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int +[0;32m[----------] [m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned [0;32m[ RUN ] [mUnsigned/TypedTestP/1.Success [0;32m[ OK ] [mUnsigned/TypedTestP/1.Success [0;32m[ RUN ] [mUnsigned/TypedTestP/1.Failure @@ -485,7 +495,7 @@ Expected equality of these values: TypeParam() Which is: 0 Expected failure -[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int +[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned [0;32m[----------] [m4 tests from ExpectFailureTest [0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailure (expecting 1 failure) @@ -644,15 +654,16 @@ FooEnvironment::TearDown() called. gtest_output_test_.cc:#: Failure Failed Expected fatal failure. -[0;32m[==========] [m67 tests from 30 test cases ran. +[0;32m[==========] [m68 tests from 30 test cases ran. [0;32m[ PASSED ] [m22 tests. -[0;31m[ FAILED ] [m45 tests, listed below: +[0;31m[ FAILED ] [m46 tests, listed below: [0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands [0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings [0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine [0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine [0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine [0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions +[0;31m[ FAILED ] [mSCOPED_TRACETest.AcceptedValues [0;31m[ FAILED ] [mSCOPED_TRACETest.ObeysScopes [0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInLoop [0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInSubroutine @@ -682,7 +693,7 @@ Expected fatal failure. [0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows [0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int [0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char -[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int +[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned [0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure [0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure [0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads @@ -693,7 +704,7 @@ Expected fatal failure. [0;31m[ FAILED ] [mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2 [0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a" -45 FAILED TESTS +46 FAILED TESTS [0;33m YOU HAVE 1 DISABLED TEST [mNote: Google Test filter = FatalFailureTest.*:LoggingTest.* diff --git a/googletest/test/gtest_pred_impl_unittest.cc b/googletest/test/gtest_pred_impl_unittest.cc index a84eff8..b466c15 100644 --- a/googletest/test/gtest_pred_impl_unittest.cc +++ b/googletest/test/gtest_pred_impl_unittest.cc @@ -27,7 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command +// This file is AUTOMATICALLY GENERATED on 01/02/2018 by command // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! // Regression test for gtest_pred_impl.h diff --git a/googletest/test/gtest_prod_test.cc b/googletest/test/gtest_prod_test.cc index 060abce..dfb9998 100644 --- a/googletest/test/gtest_prod_test.cc +++ b/googletest/test/gtest_prod_test.cc @@ -29,10 +29,10 @@ // // Author: wan@google.com (Zhanyong Wan) // -// Unit test for include/gtest/gtest_prod.h. +// Unit test for gtest/gtest_prod.h. +#include "production.h" #include "gtest/gtest.h" -#include "test/production.h" // Tests that private members can be accessed from a TEST declared as // a friend of the class. diff --git a/googletest/test/gtest_xml_test_utils.py b/googletest/test/gtest_xml_test_utils.py index 30c25d9..d303425 100755 --- a/googletest/test/gtest_xml_test_utils.py +++ b/googletest/test/gtest_xml_test_utils.py @@ -29,11 +29,9 @@ """Unit test utilities for gtest_xml_output""" -import os import re -import gtest_test_utils from xml.dom import minidom, Node - +import gtest_test_utils GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml' |