[libc-commits] [PATCH] D121564: [libc] Let exhaustive tests indicate each interval PASSED/FAILED.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Mar 16 06:55:33 PDT 2022
lntue added inline comments.
================
Comment at: libc/utils/UnitTest/LibcTest.h:404
return; \
} while (0)
----------------
sivachandra wrote:
> lntue wrote:
> > sivachandra wrote:
> > > To math the pattern of other `ASSERT_<>` macros, can we construct `ASSERT_THAT` using `EXPECT_THAT`?
> > Look like we need to have another patch to wrap other ASSERT_<> in `do { ... } while (0)` to make it not stealing `else` clause if being used inside other `if` statement.
> They are not compound statements so shouldn't require a `do {...} while (0)` treatment?
What I'm thinking is in the case that we have something like:
```
if (cond)
ASSERT_<>(...);
else
ASSERT_<>(...);
```
then without the `do { ... } while (0)` treatment, it will silently do the wrong branching due to the `else` is stolen from the first `ASSERT`.
Maybe we should not have that pattern but it might be inevitable sometime.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121564/new/
https://reviews.llvm.org/D121564
More information about the libc-commits
mailing list