diff options
| author | swarmer <[email protected]> | 2026-01-27 00:11:08 +0300 |
|---|---|---|
| committer | swarmer <[email protected]> | 2026-01-27 00:27:45 +0300 |
| commit | 109d80e2ba8a4bdb57dfe7bedab548b66bb6d15b (patch) | |
| tree | fc73b2b91072cc47b1bf288a53779427d4c9b0ad | |
| parent | e981a661fe0c504559bcfb00141c8081eb3e1f30 (diff) | |
Forbid use of array types in UNIT_ASSERT conditions #30109
commit_hash:bfc1eb4f21ecb804205db2c38e09cda4b5b9cea4
| -rw-r--r-- | library/cpp/testing/unittest/registar.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index b3b206ec5c1..16688659b8d 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -482,6 +482,7 @@ public: \ //bool #define UNIT_ASSERT_C(A, C) \ do { \ + static_assert(!std::is_array_v<std::remove_cvref_t<decltype(A)>>, "An array type always evaluates to true in a condition; this is likely an error in the condition expression."); \ if (!(A)) { \ UNIT_FAIL_IMPL("assertion failed", Sprintf("(%s) %s", #A, (::TStringBuilder() << C).data())); \ } \ |
