google / google/googletest

Surround condition macro arguments with parenthesis

Open
#3,569 1 comment 0 reactions 1 assignee Claimed by @deadlocklogic View on GitHub
enhancement
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

**Does the feature exist in the most recent commit?**

No

**Why do we need this feature?**

Many users will stubble upon simple snippet failing to compile.
https://stackoverflow.com/questions/65300353/google-test-gtest-expect-true-macro-wont-compile-with-stdis-same-te

Solutions makes code less intuitive unnecessarily.

**Describe the proposal**

_Example_: `EXPECT_TRUE`
```cpp
// Current implementation
EXPECT_TRUE((std::is_same::value));
// EXPECT_TRUE(std::is_same::value); // Compilation error
```
https://github.com/google/googletest/blob/8aa657ee397a3273f9d2bb14a10b39fd1d556a77/googletest/include/gtest/gtest.h#L1968-L1970
Just surround `condition` in `GTEST_TEST_BOOLEAN_(condition,` with parenthesis. (Do this for all relative cases).

**Is the feature specific to an operating system, compiler, or build system version?**

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.