dahstar / googletest

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

TEST_P / INSTANTIATE_TEST_CASE_P macros do not expand parameters #389

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If the TEST_P and INSTANTIATE_TEST_CASE_P macros age given parameters that are 
macros themselves, they do not expand those macros. Expanding the macros in 
parameters would make possible to conditionally disable tests.

Example:
#if defined(GTEST_OS_WINDOWS)
#define MAYBE_SomeTest DISABLED_SomeTest
#else
#define MAYBE_SomeTest SomeTest
#endif

TEST(MyTestClass, MAYBE_SomeTest) { 
}  // -> will produce a disabled test on Windows (DISABLED_SomeTest)

TEST_P(MyTestClass, MAYBE_SomeTest) {
}  // -> will produce test named MAYBE_SomeTest

More details at 
https://groups.google.com/d/topic/googletestframework/N5wCBXetcVk/discussion.

Original issue reported on code.google.com by vladlosev on 8 Nov 2011 at 5:12

GoogleCodeExporter commented 9 years ago
See https://codereview.chromium.org/12209016/ for how a similar issue is fixed 
in Chrome-land.

Original comment by bauerb@chromium.org on 5 Feb 2013 at 7:14