Page MenuHomePhabricator

[LCG] (WIP/discussion) Switch a unittest to use gmock matchers.
Needs ReviewPublic

Authored by chandlerc on Jan 4 2017, 5:30 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

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.

Event Timeline

chandlerc updated this revision to Diff 83037.Jan 4 2017, 5:30 AM
chandlerc retitled this revision from to [LCG] (WIP/discussion) Switch a unittest to use gmock matchers..
chandlerc updated this object.
chandlerc added a subscriber: llvm-commits.