diff options
-rw-r--r-- | .travis.yml | 18 | ||||
-rw-r--r-- | CMakeLists.txt | 16 | ||||
-rw-r--r-- | googlemock/Makefile.am | 8 | ||||
-rw-r--r-- | googlemock/README.md | 2 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 8 | ||||
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 4 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 44 | ||||
-rw-r--r-- | googletest/CMakeLists.txt | 18 | ||||
-rw-r--r-- | googletest/Makefile.am | 6 | ||||
-rw-r--r-- | googletest/README.md | 4 | ||||
-rw-r--r-- | googletest/docs/AdvancedGuide.md | 44 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 16 | ||||
-rw-r--r-- | googletest/src/gtest-internal-inl.h | 2 | ||||
-rw-r--r-- | googletest/test/gtest-port_test.cc | 4 |
14 files changed, 117 insertions, 77 deletions
diff --git a/.travis.yml b/.travis.yml index 90002648..3204dfac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,29 +2,29 @@ # http://about.travis-ci.org/docs/user/build-configuration/ # This file can be validated on: # http://lint.travis-ci.org/ -# See also -# http://stackoverflow.com/questions/22111549/travis-ci-with-clang-3-4-and-c11/30925448#30925448 -# to allow C++11, though we are not yet building with -std=c++11 install: # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi -# /usr/bin/clang is our version already, and clang-X.Y does not exist. -#- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +# /usr/bin/clang is 3.4, lets override with modern one. +- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi - echo ${PATH} -- ls /usr/local -- ls /usr/local/bin -- export PATH=/usr/local/bin:/usr/bin:${PATH} - echo ${CXX} - ${CXX} --version +- ${CXX} -v addons: apt: + # List of whitelisted in travis packages for ubuntu-precise can be found here: + # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise + # List of whitelisted in travis apt-sources: + # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json sources: - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.7 packages: - gcc-4.9 - g++-4.9 - - clang + - clang-3.7 - valgrind os: - linux diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8d2b552e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.6.2) + +project( googletest-distribution ) + +enable_testing() + +option(BUILD_GTEST "Builds the googletest subproject" OFF) + +#Note that googlemock target already builds googletest +option(BUILD_GMOCK "Builds the googlemock subproject" ON) + +if(BUILD_GMOCK) + add_subdirectory( googlemock ) +elseif(BUILD_GTEST) + add_subdirectory( googletest ) +endif() diff --git a/googlemock/Makefile.am b/googlemock/Makefile.am index 7ad45888..9adbc516 100644 --- a/googlemock/Makefile.am +++ b/googlemock/Makefile.am @@ -42,7 +42,10 @@ pkginclude_internaldir = $(pkgincludedir)/internal pkginclude_internal_HEADERS = \ include/gmock/internal/gmock-generated-internal-utils.h \ include/gmock/internal/gmock-internal-utils.h \ - include/gmock/internal/gmock-port.h + include/gmock/internal/gmock-port.h \ + include/gmock/internal/custom/gmock-generated-actions.h \ + include/gmock/internal/custom/gmock-matchers.h \ + include/gmock/internal/custom/gmock-port.h lib_libgmock_main_la_SOURCES = src/gmock_main.cc lib_libgmock_main_la_LIBADD = lib/libgmock.la @@ -136,7 +139,8 @@ EXTRA_DIST += \ include/gmock/gmock-generated-function-mockers.h.pump \ include/gmock/gmock-generated-matchers.h.pump \ include/gmock/gmock-generated-nice-strict.h.pump \ - include/gmock/internal/gmock-generated-internal-utils.h.pump + include/gmock/internal/gmock-generated-internal-utils.h.pump \ + include/gmock/internal/custom/gmock-generated-actions.h.pump # Script for fusing Google Mock and Google Test source files. EXTRA_DIST += scripts/fuse_gmock_files.py diff --git a/googlemock/README.md b/googlemock/README.md index d3613541..332beab3 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -69,7 +69,7 @@ Once you understand the basics, check out the rest of the docs: If you need help, please check the [KnownIssues](docs/KnownIssues.md) and -[FrequentlyAskedQuestions](docs/frequentlyaskedquestions.md) before +[FrequentlyAskedQuestions](docs/FrequentlyAskedQuestions.md) before posting a question on the [discussion group](http://groups.google.com/group/googlemock). diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index c09c4d6e..b3f654af 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -46,7 +46,7 @@ #include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-port.h" -#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h. +#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h. #include <type_traits> #endif @@ -96,7 +96,7 @@ struct BuiltInDefaultValueGetter<T, false> { template <typename T> class BuiltInDefaultValue { public: -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_TYPE_TRAITS_ // This function returns true iff type T has a built-in default value. static bool Exists() { return ::std::is_default_constructible<T>::value; @@ -107,7 +107,7 @@ class BuiltInDefaultValue { T, ::std::is_default_constructible<T>::value>::Get(); } -#else // GTEST_LANG_CXX11 +#else // GTEST_HAS_STD_TYPE_TRAITS_ // This function returns true iff type T has a built-in default value. static bool Exists() { return false; @@ -117,7 +117,7 @@ class BuiltInDefaultValue { return BuiltInDefaultValueGetter<T, false>::Get(); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_TYPE_TRAITS_ }; // This partial specialization says that we use the same built-in diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index a665fc5f..f470de4c 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -214,7 +214,7 @@ class MyNonDefaultConstructible { int value_; }; -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_TYPE_TRAITS_ TEST(BuiltInDefaultValueTest, ExistsForDefaultConstructibleType) { EXPECT_TRUE(BuiltInDefaultValue<MyDefaultConstructible>::Exists()); @@ -224,7 +224,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) { EXPECT_EQ(42, BuiltInDefaultValue<MyDefaultConstructible>::Get().value()); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_TYPE_TRAITS_ TEST(BuiltInDefaultValueTest, DoesNotExistForNonDefaultConstructibleType) { EXPECT_FALSE(BuiltInDefaultValue<MyNonDefaultConstructible>::Exists()); diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index b09acba9..78c4c901 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -1042,14 +1042,14 @@ TEST(IsNullTest, ReferenceToConstLinkedPtr) { EXPECT_FALSE(m.Matches(non_null_p)); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ TEST(IsNullTest, StdFunction) { const Matcher<std::function<void()>> m = IsNull(); EXPECT_TRUE(m.Matches(std::function<void()>())); EXPECT_FALSE(m.Matches([]{})); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ // Tests that IsNull() describes itself properly. TEST(IsNullTest, CanDescribeSelf) { @@ -1090,14 +1090,14 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) { EXPECT_TRUE(m.Matches(non_null_p)); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ TEST(NotNullTest, StdFunction) { const Matcher<std::function<void()>> m = NotNull(); EXPECT_TRUE(m.Matches([]{})); EXPECT_FALSE(m.Matches(std::function<void()>())); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ // Tests that NotNull() describes itself properly. TEST(NotNullTest, CanDescribeSelf) { @@ -2708,22 +2708,18 @@ class FloatingPointTest : public testing::Test { zero_bits_(Floating(0).bits()), one_bits_(Floating(1).bits()), infinity_bits_(Floating(Floating::Infinity()).bits()), - close_to_positive_zero_( - Floating::ReinterpretBits(zero_bits_ + max_ulps_/2)), - close_to_negative_zero_( - -Floating::ReinterpretBits(zero_bits_ + max_ulps_ - max_ulps_/2)), - further_from_negative_zero_(-Floating::ReinterpretBits( + close_to_positive_zero_(AsBits(zero_bits_ + max_ulps_/2)), + close_to_negative_zero_(AsBits(zero_bits_ + max_ulps_ - max_ulps_/2)), + further_from_negative_zero_(-AsBits( zero_bits_ + max_ulps_ + 1 - max_ulps_/2)), - close_to_one_(Floating::ReinterpretBits(one_bits_ + max_ulps_)), - further_from_one_(Floating::ReinterpretBits(one_bits_ + max_ulps_ + 1)), + close_to_one_(AsBits(one_bits_ + max_ulps_)), + further_from_one_(AsBits(one_bits_ + max_ulps_ + 1)), infinity_(Floating::Infinity()), - close_to_infinity_( - Floating::ReinterpretBits(infinity_bits_ - max_ulps_)), - further_from_infinity_( - Floating::ReinterpretBits(infinity_bits_ - max_ulps_ - 1)), + close_to_infinity_(AsBits(infinity_bits_ - max_ulps_)), + further_from_infinity_(AsBits(infinity_bits_ - max_ulps_ - 1)), max_(Floating::Max()), - nan1_(Floating::ReinterpretBits(Floating::kExponentBitMask | 1)), - nan2_(Floating::ReinterpretBits(Floating::kExponentBitMask | 200)) { + nan1_(AsBits(Floating::kExponentBitMask | 1)), + nan2_(AsBits(Floating::kExponentBitMask | 200)) { } void TestSize() { @@ -2804,6 +2800,12 @@ class FloatingPointTest : public testing::Test { // Some NaNs. const RawType nan1_; const RawType nan2_; + + private: + template <typename T> + static RawType AsBits(T value) { + return Floating::ReinterpretBits(static_cast<Bits>(value)); + } }; // Tests floating-point matchers with fixed epsilons. @@ -3179,6 +3181,8 @@ MATCHER_P(FieldIIs, inner_matcher, "") { return ExplainMatchResult(inner_matcher, arg.i, result_listener); } +#if GTEST_HAS_RTTI + TEST(WhenDynamicCastToTest, SameType) { Derived derived; derived.i = 4; @@ -3236,12 +3240,8 @@ TEST(WhenDynamicCastToTest, AmbiguousCast) { TEST(WhenDynamicCastToTest, Describe) { Matcher<Base*> matcher = WhenDynamicCastTo<Derived*>(Pointee(_)); -#if GTEST_HAS_RTTI const string prefix = "when dynamic_cast to " + internal::GetTypeName<Derived*>() + ", "; -#else // GTEST_HAS_RTTI - const string prefix = "when dynamic_cast, "; -#endif // GTEST_HAS_RTTI EXPECT_EQ(prefix + "points to a value that is anything", Describe(matcher)); EXPECT_EQ(prefix + "does not point to a value that is anything", DescribeNegation(matcher)); @@ -3275,6 +3275,8 @@ TEST(WhenDynamicCastToTest, BadReference) { EXPECT_THAT(as_base_ref, Not(WhenDynamicCastTo<const OtherDerived&>(_))); } +#endif // GTEST_HAS_RTTI + // Minimal const-propagating pointer. template <typename T> class ConstPropagatingPtr { diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index bd78cfe6..9ef6a93f 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -22,6 +22,11 @@ option(gtest_build_samples "Build gtest's sample programs." OFF) option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF) +option( + gtest_hide_internal_symbols + "Build gtest with internal symbols hidden in shared libraries." + OFF) + # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). include(cmake/hermetic_build.cmake OPTIONAL) @@ -46,6 +51,11 @@ if (COMMAND set_up_hermetic_build) set_up_hermetic_build() endif() +if (gtest_hide_internal_symbols) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +endif() + # Define helper functions and macros used by Google Test. include(cmake/internal_utils.cmake) @@ -83,6 +93,14 @@ target_link_libraries(gtest_main gtest) ######################################################################## # +# Install rules +install(TARGETS gtest gtest_main + DESTINATION lib) +install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest + DESTINATION include) + +######################################################################## +# # Samples on how to link user tests with gtest or gtest_main. # # They are not built by default. To build them, set the diff --git a/googletest/Makefile.am b/googletest/Makefile.am index 9c96b425..29797e4e 100644 --- a/googletest/Makefile.am +++ b/googletest/Makefile.am @@ -205,9 +205,13 @@ pkginclude_internal_HEADERS = \ include/gtest/internal/gtest-param-util-generated.h \ include/gtest/internal/gtest-param-util.h \ include/gtest/internal/gtest-port.h \ + include/gtest/internal/gtest-port-arch.h \ include/gtest/internal/gtest-string.h \ include/gtest/internal/gtest-tuple.h \ - include/gtest/internal/gtest-type-util.h + include/gtest/internal/gtest-type-util.h \ + include/gtest/internal/custom/gtest.h \ + include/gtest/internal/custom/gtest-port.h \ + include/gtest/internal/custom/gtest-printers.h lib_libgtest_main_la_SOURCES = src/gtest_main.cc lib_libgtest_main_la_LIBADD = lib/libgtest.la diff --git a/googletest/README.md b/googletest/README.md index 9bd59c8e..e0ea1b0f 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -54,7 +54,7 @@ it. ### Using CMake ### Google Test comes with a CMake build script ( -[CMakeLists.txt](master/CMakeLists.txt)) that can be used on a wide range of platforms ("C" stands for +[CMakeLists.txt](CMakeLists.txt)) that can be used on a wide range of platforms ("C" stands for cross-platform.). If you don't have CMake installed already, you can download it for free from <http://www.cmake.org/>. @@ -136,7 +136,7 @@ these macros are named like `GTEST_XYZ` and you define them to either 1 or 0 to enable or disable a certain feature. We list the most frequently used macros below. For a complete list, -see file [include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/include/gtest/internal/gtest-port.h). +see file [include/gtest/internal/gtest-port.h](include/gtest/internal/gtest-port.h). ### Choosing a TR1 Tuple Library ### diff --git a/googletest/docs/AdvancedGuide.md b/googletest/docs/AdvancedGuide.md index 576efc35..4d34ba5b 100644 --- a/googletest/docs/AdvancedGuide.md +++ b/googletest/docs/AdvancedGuide.md @@ -44,7 +44,7 @@ switch(expression) { } ``` -Note: you can only use `FAIL()` in functions that return `void`. See the [Assertion Placement section](#Assertion_Placement.md) for more information. +Note: you can only use `FAIL()` in functions that return `void`. See the [Assertion Placement section](#assertion-placement) for more information. _Availability_: Linux, Windows, Mac. @@ -125,7 +125,7 @@ c is 10<br> **Notes:** - 1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this](http://code.google.com/p/googletest/wiki/FAQ#The_compiler_complains_%22no_matching_function_to_call%22) for how to resolve it. + 1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this FAQ](FAQ.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert_predn-how-do-i-fix-it) for how to resolve it. 1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know. _Availability_: Linux, Windows, Mac @@ -517,9 +517,9 @@ _death tests_. More generally, any test that checks that a program terminates Note that if a piece of code throws an exception, we don't consider it "death" for the purpose of death tests, as the caller of the code could catch the exception and avoid the crash. If you want to verify exceptions thrown by your code, -see [Exception Assertions](#Exception_Assertions.md). +see [Exception Assertions](#exception-assertions). -If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#Catching_Failures.md). +If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#catching-failures). ## How to Write a Death Test ## @@ -1199,9 +1199,9 @@ which are all in the `testing` namespace: | `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. | | `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time. | | `Bool()` | Yields sequence `{false, true}`. | -| `Combine(g1, g2, ..., gN)` | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/internal/gtest-port.h) for more information. | +| `Combine(g1, g2, ..., gN)` | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h) for more information. | -For more details, see the comments at the definitions of these functions in the [source code](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest-param-test.h). +For more details, see the comments at the definitions of these functions in the [source code](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-param-test.h). The following statement will instantiate tests from the `FooTest` test case each with parameter values `"meeny"`, `"miny"`, and `"moe"`. @@ -1226,7 +1226,7 @@ names: * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"` * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"` -You can use these names in [--gtest\_filter](#Running_a_Subset_of_the_Tests.md). +You can use these names in [--gtest\_filter](#running-a-subset-of-the-tests). This statement will instantiate all tests from `FooTest` again, each with parameter values `"cat"` and `"dog"`: @@ -1249,8 +1249,8 @@ tests in the given test case, whether their definitions come before or _after_ the `INSTANTIATE_TEST_CASE_P` statement. You can see -[these](http://code.google.com/p/googletest/source/browse/trunk/samples/sample7_unittest.cc) -[files](http://code.google.com/p/googletest/source/browse/trunk/samples/sample8_unittest.cc) for more examples. +[these](https://github.com/google/googletest/blob/master/googletest/samples/sample7_unittest.cc) +[files](https://github.com/google/googletest/blob/master/googletest/samples/sample8_unittest.cc) for more examples. _Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0. @@ -1646,8 +1646,8 @@ _Availability:_ Linux, Windows, Mac; since v1.4.0. ## Defining Event Listeners ## To define a event listener, you subclass either -[testing::TestEventListener](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#855) -or [testing::EmptyTestEventListener](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#905). +[testing::TestEventListener](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L991) +or [testing::EmptyTestEventListener](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1044). The former is an (abstract) interface, where <i>each pure virtual method<br> can be overridden to handle a test event</i> (For example, when a test starts, the `OnTestStart()` method will be called.). The latter provides @@ -1656,10 +1656,10 @@ subclass only needs to override the methods it cares about. When an event is fired, its context is passed to the handler function as an argument. The following argument types are used: - * [UnitTest](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#1007) reflects the state of the entire test program, - * [TestCase](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#689) has information about a test case, which can contain one or more tests, - * [TestInfo](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#599) contains the state of a test, and - * [TestPartResult](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest-test-part.h#42) represents the result of a test assertion. + * [UnitTest](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1151) reflects the state of the entire test program, + * [TestCase](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L778) has information about a test case, which can contain one or more tests, + * [TestInfo](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L644) contains the state of a test, and + * [TestPartResult](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-test-part.h#L47) represents the result of a test assertion. An event handler function can examine the argument it receives to find out interesting information about the event and the test program's @@ -1695,7 +1695,7 @@ state. Here's an example: To use the event listener you have defined, add an instance of it to the Google Test event listener list (represented by class -[TestEventListeners](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#929) +[TestEventListeners](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1064) - note the "s" at the end of the name) in your `main()` function, before calling `RUN_ALL_TESTS()`: ``` @@ -1723,7 +1723,7 @@ event listener list and delete it. You can do so by adding one line: Now, sit back and enjoy a completely different output from your tests. For more details, you can read this -[sample](http://code.google.com/p/googletest/source/browse/trunk/samples/sample9_unittest.cc). +[sample](https://github.com/google/googletest/blob/master/googletest/samples/sample9_unittest.cc). You may append more than one listener to the list. When an `On*Start()` or `OnTestPartResult()` event is fired, the listeners will receive it in @@ -1748,7 +1748,7 @@ failures. This ensures that failures generated by the latter are attributed to the right test by the former. We have a sample of failure-raising listener -[here](http://code.google.com/p/googletest/source/browse/trunk/samples/sample10_unittest.cc). +[here](https://github.com/google/googletest/blob/master/googletest/samples/sample10_unittest.cc). # Running Test Programs: Advanced Options # @@ -1868,12 +1868,12 @@ _Availability:_ Linux, Windows, Mac. ### Temporarily Enabling Disabled Tests ### -To include [disabled tests](#Temporarily_Disabling_Tests.md) in test +To include [disabled tests](#temporarily-disabling-tests) in test execution, just invoke the test program with the `--gtest_also_run_disabled_tests` flag or set the `GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other than `0`. You can combine this with the -[--gtest\_filter](#Running_a_Subset_of_the_Tests.md) flag to further select +[--gtest\_filter](#running-a-subset-of-the-tests) flag to further select which disabled tests to run. _Availability:_ Linux, Windows, Mac; since version 1.3.0. @@ -2173,11 +2173,11 @@ and you should see an `OUTPUT_DIR` directory being created with files `gtest/gtest.h` and `gtest/gtest-all.cc` in it. These files contain everything you need to use Google Test. Just copy them to anywhere you want and you are ready to write tests. You can use the -[scripts/test/Makefile](http://code.google.com/p/googletest/source/browse/trunk/scripts/test/Makefile) +[scripts/test/Makefile](https://github.com/google/googletest/blob/master/googletest/scripts/test/Makefile) file as an example on how to compile your tests against them. # Where to Go from Here # Congratulations! You've now learned more advanced Google Test tools and are ready to tackle more complex testing tasks. If you want to dive even deeper, you -can read the [Frequently-Asked Questions](FAQ.md).
\ No newline at end of file +can read the [Frequently-Asked Questions](FAQ.md). diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 141d4579..a8d81ff7 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -358,8 +358,9 @@ # define GTEST_HAS_STD_FUNCTION_ 1 # define GTEST_HAS_STD_INITIALIZER_LIST_ 1 # define GTEST_HAS_STD_MOVE_ 1 -# define GTEST_HAS_STD_UNIQUE_PTR_ 1 # define GTEST_HAS_STD_SHARED_PTR_ 1 +# define GTEST_HAS_STD_TYPE_TRAITS_ 1 +# define GTEST_HAS_STD_UNIQUE_PTR_ 1 #endif // C++11 specifies that <tuple> provides std::tuple. @@ -920,14 +921,14 @@ using ::std::tuple_size; #endif // GTEST_HAS_SEH #ifdef _MSC_VER - # if GTEST_LINKED_AS_SHARED_LIBRARY # define GTEST_API_ __declspec(dllimport) # elif GTEST_CREATE_SHARED_LIBRARY # define GTEST_API_ __declspec(dllexport) # endif - -#endif // _MSC_VER +#elif __GNUC__ >= 4 || defined(__clang__) +# define GTEST_API_ __attribute__((visibility ("default"))) +#endif // _MSC_VER #ifndef GTEST_API_ # define GTEST_API_ @@ -1968,13 +1969,8 @@ class MutexBase { extern ::testing::internal::MutexBase mutex // Defines and statically (i.e. at link time) initializes a static mutex. -// The initialization list here does not explicitly initialize each field, -// instead relying on default initialization for the unspecified fields. In -// particular, the owner_ field (a pthread_t) is not explicitly initialized. -// This allows initialization to work whether pthread_t is a scalar or struct. -// The flag -Wmissing-field-initializers must not be specified for this to work. # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ - ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false } + ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() } // The Mutex class can only be used for mutexes created at runtime. It // shares its API with MutexBase otherwise. diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 56c8a20c..ed8a682a 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -1032,7 +1032,7 @@ class TestResultAccessor { #if GTEST_CAN_STREAM_RESULTS_ // Streams test results to the given port on the given host machine. -class StreamingListener : public EmptyTestEventListener { +class GTEST_API_ StreamingListener : public EmptyTestEventListener { public: // Abstract base class for writing strings to a socket. class AbstractSocketWriter { diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index d17bad00..6ea607bc 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -75,8 +75,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) { } TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { - EXPECT_FALSE(IsXDigit(static_cast<char>(0x80))); - EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80))); + EXPECT_FALSE(IsXDigit('\x80')); + EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80'))); } TEST(IsXDigitTest, WorksForWideAscii) { |