add messages to utility test functions

So that e.g. parseDump() in case of an incorrect xpath does not just
plain give an equality assertion failure, which on its own is confusing.

Change-Id: Ib9fc2b4f6720b5c472773afbe8dc18cd8961465c
This commit is contained in:
Luboš Luňák
2014-03-18 19:17:43 +01:00
parent 9970d5d987
commit e1036f0fae

View File

@@ -274,7 +274,7 @@ protected:
xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc); xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx); xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx);
xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval; xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes)); CPPUNIT_ASSERT_EQUAL_MESSAGE("parsing dump failed", 1, xmlXPathNodeSetGetLength(pXmlNodes));
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
OUString aRet; OUString aRet;
if (aAttribute.getLength()) if (aAttribute.getLength())
@@ -352,7 +352,7 @@ protected:
uno::Reference<text::XTextRange> const xParagraph( uno::Reference<text::XTextRange> const xParagraph(
getParagraphOrTable(number), uno::UNO_QUERY_THROW); getParagraphOrTable(number), uno::UNO_QUERY_THROW);
if( !content.isEmpty()) if( !content.isEmpty())
CPPUNIT_ASSERT_EQUAL( content, xParagraph->getString()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "paragraph does not have expected content", content, xParagraph->getString());
return xParagraph; return xParagraph;
} }
@@ -360,7 +360,7 @@ protected:
{ {
uno::Reference<text::XTextRange> const xParagraph(getParagraphOrTable(number, xText), uno::UNO_QUERY_THROW); uno::Reference<text::XTextRange> const xParagraph(getParagraphOrTable(number, xText), uno::UNO_QUERY_THROW);
if (!content.isEmpty()) if (!content.isEmpty())
CPPUNIT_ASSERT_EQUAL(content, xParagraph->getString()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "paragraph does not contain expected content", content, xParagraph->getString());
return xParagraph; return xParagraph;
} }
@@ -373,7 +373,7 @@ protected:
xRunEnum->nextElement(); xRunEnum->nextElement();
uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY); uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
if( !content.isEmpty()) if( !content.isEmpty())
CPPUNIT_ASSERT_EQUAL( content, xRun->getString()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "run does not contain expected content", content, xRun->getString());
return xRun; return xRun;
} }
@@ -399,7 +399,7 @@ protected:
{ {
uno::Reference<text::XText> const xCellText(xCell, uno::Reference<text::XText> const xCellText(xCell,
uno::UNO_QUERY_THROW); uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL(rContent, xCellText->getString()); CPPUNIT_ASSERT_EQUAL_MESSAGE("cell does not contain expected content", rContent, xCellText->getString());
} }
return xCell; return xCell;
} }