diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-02-03 09:26:40 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-02-03 12:20:03 +0100 |
commit | 839e53b933322b739a7f534af58c63a2c69af7bd (patch) | |
tree | 5e1f7a40519dd2704546770f286583c710bbd477 /compilerplugins | |
parent | b3a11c8f4f307bbbb597c9c6e7e61ee93e794873 (diff) |
compilerplugins: enable loplugin:cppunitassertequals by default
This forces writing a comparision of two variables in the
CPPUNIT_ASSERT_EQUALS(expected, actual) form, rather than
CPPUNIT_ASSERT(actual == expected). The benefit is when the test fail,
it's more clear what are these two values, rather than just seeing that
they are not equal.
In the relatively rare case when the types are not streamable, the
plugin can be silenced using CPPUNIT_ASSERT(bool(it == foo.end())). But
please always first consider making the type streamable instead. See
commit 0e1b831b93048c68735f2e2dbdcee587db4862ef
(CppunitTest_vcl_complextext: fix loplugin:cppunitassertequals warnings,
2016-12-16) for an example.
Change-Id: I564fb0724836b6dbbea9262b53ad646e285a339c
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/cppunitassertequals.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compilerplugins/clang/cppunitassertequals.cxx b/compilerplugins/clang/cppunitassertequals.cxx index e9f4c0256516..858ad9615cbe 100644 --- a/compilerplugins/clang/cppunitassertequals.cxx +++ b/compilerplugins/clang/cppunitassertequals.cxx @@ -99,7 +99,7 @@ void CppunitAssertEquals::checkExpr(const Stmt* stmt) << stmt->getSourceRange(); } -loplugin::Plugin::Registration< CppunitAssertEquals > X("cppunitassertequals", false); +loplugin::Plugin::Registration< CppunitAssertEquals > X("cppunitassertequals"); } |