diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/qa/cppunit/test_xpath.cxx | 3 | ||||
-rw-r--r-- | test/source/xmltesttools.cxx | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/test/qa/cppunit/test_xpath.cxx b/test/qa/cppunit/test_xpath.cxx index 12852fc7dc6e..87d6a7ac177e 100644 --- a/test/qa/cppunit/test_xpath.cxx +++ b/test/qa/cppunit/test_xpath.cxx @@ -35,6 +35,9 @@ CPPUNIT_TEST_FIXTURE(TestXPath, test_getXPath) CPPUNIT_ASSERT_EQUAL(OUString("val"), getXPath(pTable, "/xml/item", "attrib")); // Trying to get position of missing child of a node must fail assertion CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pTable, "/xml/item", "absent")); + // Asserting that an attribute is absent + CPPUNIT_ASSERT_ASSERTION_FAIL(assertXPathNoAttribute(pTable, "/xml/item", "attrib")); + CPPUNIT_ASSERT_ASSERTION_PASS(assertXPathNoAttribute(pTable, "/xml/item", "foo")); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index 12aed37f18e0..f92c380d9bf8 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -247,8 +247,8 @@ void XmlTestTools::assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(), 1, xmlXPathNodeSetGetLength(pXmlNodes)); xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; - CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(), - static_cast<xmlChar*>(nullptr), xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))); + CPPUNIT_ASSERT_MESSAGE(OString(OString::Concat("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(), + !xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))); xmlXPathFreeObject(pXmlObj); } |