[llvm-dev] RFC: Reconsidering adding gmock to LLVM's unittest utilities

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 4 14:43:59 PST 2017


Chandler Carruth via llvm-dev <llvm-dev at lists.llvm.org> writes:
> On Wed, Jan 4, 2017 at 11:55 AM Pete Cooper via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>>   EXPECT_THAT(actual, Eq(expected));
>>   EXPECT_THAT(actual, Ne(not-expected));
>>
>> For the cases where you have containers and other non-trivial objects, I
>> completely agree that this is compelling.  However, for simple cases like
>> string equality I don't like the change from EXPECT_EQ(a, b) to
>> EXPECT_THAT(a, Eq(b)).
>>
>
> I'd like to understand -- why do you not like it?
>
> On one hand, I dislike it because it is longer to type and read.
> On the other hand, I like it because it is more consistent and explicit
> what is being *tested* and what the *expectation* is.

Personally I actually kind of like how the gmock matchers read - "expect
that actual equals expected" rather than "expect equal thing
other-thing".


More information about the llvm-dev mailing list