olegantonyan / googletest

Automatically exported from code.google.com/p/googletest. Added qmake build
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

gtest-port_test.cc tries to use testing::Types without looking at GTEST_HAS_TYPED_TEST #238

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1a. Set GTEST_HAS_TYPED_TEST to 0 and GTEST_USES_POSIX_RE to 1
1b. ...or try to compile with the Sun Studio compiler

What is the expected output? What do you see instead?
I would expect the code to check whether it can use testing::Types.

The compilation fails, "testing::Types is not a member of testing".

What version of the product are you using? On what operating system?
Linux, with the Sun Studio 12 compiler.

Here's a possible check for the issue:

diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc
index df59f9e..e36cbe4 100644
--- a/test/gtest-port_test.cc
+++ b/test/gtest-port_test.cc
@@ -164,6 +164,10 @@ TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
 template <typename Str>
 class RETest : public ::testing::Test {};

+// testing::Types is only available when GTEST_HAS_TYPED_TEST is set
+#if !GTEST_HAS_TYPED_TEST
+# error "Need GTEST_HAS_TYPED_TEST for testing::Types"
+#endif
 // Defines StringTypes as the list of all string types that class RE
 // supports.
 typedef testing::Types<

I also thought of using this:
#if GTEST_USES_POSIX_RE && GTEST_HAS_TYPED_TEST

...but if GTEST_USES_POSIX_RE is set and GTEST_HAS_TYPED_TEST unset, no 
regex tests are compiled:

#if GTEST_USES_POSIX_RE && GTEST_HAS_TYPED_TEST
...not compiled, because GTEST_HAS_TYPED_TEST is unset
#elif GTEST_USES_SIMPLE_RE
...not compiled, because GTEST_USES_SIMPLE_RE is unset
#endif  // GTEST_USES_POSIX_RE

Original issue reported on code.google.com by maciej.b...@gmail.com on 22 Dec 2009 at 9:32

GoogleCodeExporter commented 9 years ago

Original comment by w...@google.com on 22 Dec 2009 at 5:36