From f315fee54eee57e6e55e5fcacf2522534682c2ce Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 10 Apr 2019 15:18:07 +0300 Subject: 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 Tested-by: Mike Kaganski --- test/source/xmltesttools.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index 7fd6a4ee9e0d..123af01b28db 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -83,6 +83,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); -- cgit v1.2.3