summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-10-02 23:19:29 (GMT)
committerGennadiy Civil <misterg@google.com>2019-10-03 14:52:07 (GMT)
commit4105eb726341fb79a2f5fbb8bba29e8d1165169b (patch)
treeae99f475765a3ab1caeb196dd10ebfc0151d0340 /googletest
parent68319c19eb01a718bc32fed21bb4ee72ffc2b0bf (diff)
downloadgoogletest-4105eb726341fb79a2f5fbb8bba29e8d1165169b.zip
googletest-4105eb726341fb79a2f5fbb8bba29e8d1165169b.tar.gz
googletest-4105eb726341fb79a2f5fbb8bba29e8d1165169b.tar.bz2
Googletest export
Add a compile time check to ensure that the parameters to TEST and TEST_F are not empty Some compilers may already fail in that case and even where it works, it's likely to result in technically invalid code by virtue of creating reserved identifiers: https://en.cppreference.com/w/cpp/language/identifiers PiperOrigin-RevId: 272543242
Diffstat (limited to 'googletest')
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 82ec6e2..94c816a 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -1348,6 +1348,10 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
// Helper macro for defining tests.
#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
+ static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \
+ "test_suite_name must not be empty"); \
+ static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \
+ "test_name must not be empty"); \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
: public parent_class { \
public: \