Kaydet (Commit) 839e53b9 authored tarafından Miklos Vajna's avatar Miklos Vajna

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 0e1b831b
(CppunitTest_vcl_complextext: fix loplugin:cppunitassertequals warnings,
2016-12-16) for an example.

Change-Id: I564fb0724836b6dbbea9262b53ad646e285a339c
üst b3a11c8f
...@@ -99,7 +99,7 @@ void CppunitAssertEquals::checkExpr(const Stmt* stmt) ...@@ -99,7 +99,7 @@ void CppunitAssertEquals::checkExpr(const Stmt* stmt)
<< stmt->getSourceRange(); << stmt->getSourceRange();
} }
loplugin::Plugin::Registration< CppunitAssertEquals > X("cppunitassertequals", false); loplugin::Plugin::Registration< CppunitAssertEquals > X("cppunitassertequals");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment