[llvm] r305519 - UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 16:02:47 PDT 2017


> On Jun 15, 2017, at 3:57 PM, David Blaikie via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 
> 
> On Thu, Jun 15, 2017 at 3:52 PM Matthias Braun <mbraun at apple.com <mailto:mbraun at apple.com>> wrote:
> 
> > On Jun 15, 2017, at 3:46 PM, Matthias Braun via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> >
> > Indeed. Unfortunately I am running into problems now as ASSERT_TRUE appears to expand into something ending in "return;" in the error case which only works in void functions. Still looking around what the correct gtest idiom is.
> I moved the one problematic ASSERTs into a void function.
> 
> Not sure how much that'd help though -it means the callers to the function will continue running after the ASSERT fails, right? Unless it's moved up to the top level TEST function.
Yep that is subtle, but happens to work fine in this case... It's basically one function call to perform the test and we abort that function in the error case which still makes sense.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170615/826cb687/attachment.html>


More information about the llvm-commits mailing list