include/test/xmltesttools.hxx | 10 +++------- test/source/xmltesttools.cxx | 5 ----- 2 files changed, 3 insertions(+), 12 deletions(-)
New commits: commit 2f91ab025de850fe5af8114565755a8deed55911 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Nov 25 16:36:57 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Nov 25 17:19:10 2022 +0100 Merge two assertXPath overloads that both check number of nodes Change-Id: I67eec623b90ab20330fa0c268152211b6bbdbe1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143301 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index a9f30f7d227d..09f06af5eb0d 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -65,10 +65,6 @@ protected: * Get the number of the nodes returned by the rXPath. */ int countXPathNodes(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); - /** - * Assert that rXPath exists, and returns exactly one node. - */ - void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); /** * Assert that rXPath exists, returns exactly one node, and the rXPath's attribute's value * equals to the rExpected value. @@ -78,10 +74,10 @@ protected: void assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const std::vector<std::pair<OString, OUString>>& aPairVector); /** - * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes. - * Useful for checking that we do _not_ export some node (nNumberOfNodes == 0). + * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes (1 by default). + * Also useful for checking that we do _not_ export some node (nNumberOfNodes == 0). */ - void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes); + void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes = 1); /** * Assert that rXPath exists, and its content equals rContent. */ diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index 26973b440c61..e329bc968760 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -162,11 +162,6 @@ OUString XmlTestTools::getXPathContent(const xmlDocUniquePtr& pXmlDoc, const OSt CPPUNIT_FAIL("Invalid XPath type"); } -void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) -{ - getXPath(pXmlDoc, rXPath, ""); // it asserts that rXPath exists, and returns exactly one node -} - void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue) { OUString aValue = getXPath(pXmlDoc, rXPath, rAttribute);