diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-02-08 07:48:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-02-08 09:15:01 +0100 |
commit | 6b00d0576a310796590631d14c54d7d5ea6814ac (patch) | |
tree | 2e11a4454592be39cfeaa68458cae964d8cdef5e /starmath | |
parent | 17149f65f03a34e88bb4a10abcd20e6891f5d7ca (diff) |
Improve loplugin:cppunitassertequal for CPPUNIT_ASSERT(a && b)
...by re-enabling the code temporarily #if'ed-out in
a528392e71bc70136021be4e3d83732fccbb885e "Fixed/improved
loplugin:cppunitassertequals" (and which then triggers lots of other
lopglugin:cppunitassertequal CPPUNIT_ASSERT -> CPPUNIT_ASSERT_EQUAL warnings).
For two css::uno::Reference equality comparisons in cppu/qa/test_any.cxx, it
was more straightforward to rewrite them with an explicit call to operator ==
(which silences loplugin:cppunitassertequal) than to adapt them to
CPPUNIT_ASSERT_EQUAL's requirement for arguments of identical types.
In sc/qa/unit/ucalc_pivottable.cxx, ScDPItemData needs toString, which has been
implemented trivially for now, but might want to combine that with the
DEBUG_PIVOT_TABLE-only ScDPItemData::Dump.
Change-Id: Iae6d09cf69bd4e52fe4411bba9e50c48e696291c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110546
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/qa/cppunit/test_starmath.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index c9e6f2c35663..480796aaddd4 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -237,22 +237,30 @@ void Test::editFailure() const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError(); CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::ColorExpected", - pErrorDesc && pErrorDesc->m_eType == SmParseError::ColorExpected); + pErrorDesc); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a SmParseError::ColorExpected", + SmParseError::ColorExpected, pErrorDesc->m_eType); pErrorDesc = m_xDocShRef->GetParser().PrevError(); CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::UnexpectedChar", - pErrorDesc && pErrorDesc->m_eType == SmParseError::UnexpectedChar); + pErrorDesc); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a SmParseError::UnexpectedChar", + SmParseError::UnexpectedChar, pErrorDesc->m_eType); pErrorDesc = m_xDocShRef->GetParser().PrevError(); CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::RgroupExpected", - pErrorDesc && pErrorDesc->m_eType == SmParseError::RgroupExpected); + pErrorDesc); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a SmParseError::RgroupExpected", + SmParseError::RgroupExpected, pErrorDesc->m_eType); const SmErrorDesc *pLastErrorDesc = m_xDocShRef->GetParser().PrevError(); CPPUNIT_ASSERT_MESSAGE("Should be three syntax errors", - pLastErrorDesc && pLastErrorDesc == pErrorDesc); + pLastErrorDesc); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be three syntax errors", + pErrorDesc, pLastErrorDesc); } void Test::ParseErrorUnexpectedToken() |