[PATCH] D28290: [LCG] (WIP/discussion) Switch a unittest to use gmock matchers.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 05:30:08 PST 2017


chandlerc created this revision.
chandlerc added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

This provides a substantial readability improvement IMO and also
showcases how to use gmock matchers. I'm even defining custom matchers
to facilitate the specific patterns used throughout this test code.

Even with the (fairly verbose) definition of slightly fancy new matcher,
the total code size shrinks. In several cases the checks are now
substantially more precise. And the failure messages will be much more
explanatory when things go wrong.

Note that I'm not looking for immediate or detailed review. This patch is
mostly to serve as an example in an llvm-dev discussion about whether we should
start leveraging some facitilies of GoogleMock in LLVM unit tests.


https://reviews.llvm.org/D28290

Files:
  unittests/Analysis/LazyCallGraphTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28290.83037.patch
Type: text/x-patch
Size: 68541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170104/25d7040d/attachment.bin>


More information about the llvm-commits mailing list