summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-10 15:18:07 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-12 23:09:04 +0200
commite90664da377faf37b668416a4da16bc7f04870e7 (patch)
tree6e07e9fe1e595800093118146b21fcca2a6d4d44 /test
parentcba44da5458824dfddfa785b3fd41347cd975756 (diff)
XmlTestTools::getXPath now asserts that non-empty attribute exists
It turns out that this change revealed unit tests written incorrectly (and untested), or maybe which became broken (not testing) because of some previous assertXPath change? They incorrectly used 3-arg form of it to check node content equality to passed string, while in fact, an attribute was looked for with that name, and its empty return tested to match default empty 4th argument. Change-Id: If24e18518543102d115a22a6282e4cca9cf694e2 Reviewed-on: https://gerrit.libreoffice.org/70581 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/70680
Diffstat (limited to 'test')
-rw-r--r--test/source/xmltesttools.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 7a6f035fc986..26c54daa7fdb 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -73,6 +73,9 @@ OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const
return OUString();
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
xmlChar * prop = xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()));
+ OString sAttAbsent = "In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath
+ + "' no attribute '" + rAttribute + "' exist";
+ CPPUNIT_ASSERT_MESSAGE(sAttAbsent.getStr(), prop);
OUString s(convert(prop));
xmlFree(prop);
xmlXPathFreeObject(pXmlObj);