[PATCH] D65643: unittests: Add a (centralized) ability to match std::error_code

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 04:21:34 PDT 2019


labath added a comment.

Hmm... so, by piggy-backing on the `StreamSwitch` thingy I was able to write a `operator<<(raw_ostream, std::error_code)` which would print the error message. However, that only seems to work when comparing two error_codes (EXPECT_EQ and friends). When simply testing the truth value (EXPECT_FALSE), it seems to get converted to bool before it gets printed and all I get is the signature "false is not true" :P. Maybe we could adopt the convention to write `EXPECT_EQ(foo(), std::error_code())`? -- I find it confusing that EXPECT_FALSE expects success anyway...


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65643/new/

https://reviews.llvm.org/D65643





More information about the llvm-commits mailing list