[Documentation]: Clarify which string comparison macros support wide strings
- Dominant language
- C++
- Stars
- 39.6k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
### Describe the issue
## Summary
There seems to be an inconsistency in the documentation regarding wide string (`wchar_t*`) support in string comparison assertions.
## Details
In older versions of the documentation (e.g. v1.10.x), the [primer.md](https://github.com/google/googletest/blob/v1.10.x/googletest/docs/primer.md#string-comparison) stated:
> `*STREQ* and *STRNE* also accept wide C strings (wchar_t*).`
In newer versions (e.g. v1.12.x and later), this wording in [reference/assertions.md](https://github.com/google/googletest/blob/v1.12.x/docs/reference/assertions.md#string-comparison-c-strings) changed to:
> `These assertions also accept wide C strings (wchar_t*).`
This phrasing makes it look like all string-related assertions (including `EXPECT_STRCASEEQ` / `EXPECT_STRCASENE`) support wide C strings.
However, based on the implementation and testing, only `EXPECT_STREQ` and `EXPECT_STRNE` actually support `wchar_t*`. The case-insensitive variants (`EXPECT_STRCASEEQ` / `EXPECT_STRCASENE`) do **not** support wide strings.
## Expected
The documentation should clearly state that **only** `EXPECT_STREQ` and `EXPECT_STRNE` support `wchar_t*`, and that the case-insensitive variants do not.
## Suggested fix
Reword the documentation to explicitly mention which macros support wide C strings, to avoid confusion for users.
Example:
> "`EXPECT_STREQ` and `EXPECT_STRNE` also accept wide C strings (`wchar_t*`).
> Case-insensitive variants (`EXPECT_STRCASEEQ` and `EXPECT_STRCASENE`) currently do not support wide C strings."
---
This should help clarify the intended behavior and avoid misleading readers.
### Steps to reproduce the problem
```c++
#include
#include
TEST(Tests, Test) {
EXPECT_STRCASEEQ(L"HELLO", L"hello"); // cannot compile
EXPECT_STRCASENE(L"HELLO", L"hello"); // cannot compile
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
```
### What version of GoogleTest are you using?
1.17.0
### What operating system and version are you using?
Windows 11 24H2
### What compiler and version are you using?
`cl.exe`
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35213 for x64
### What build system are you using?
`cmake --version`
cmake version 4.0.3
### Additional context
_No response_
Contributor guide
Research direction
Start with docs/reference/assertions.md at the string-comparison C-strings section, then compare its wording with the implementation and behavior described in the issue. Clarify that only EXPECT_STREQ and EXPECT_STRNE accept wchar_t*, while EXPECT_STRCASEEQ and EXPECT_STRCASENE do not; the documentation is done when it no longer implies otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation, testing-qa
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100