summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-04-23 21:50:52 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-04-26 17:42:44 +0200
commit8ecf34e8237c3cdcb0cd3f56cfba9b3e6579a98f (patch)
tree927fc20345629d7a5b76bba3b23cbae5fa431212 /test
parent4fb081704811b66194ea11e528ad792957b7ccfd (diff)
xml diff - report what attribute values actually differ
Change-Id: I16bc122e3f2cce94a5eb8454b528bf484210a4ae Reviewed-on: https://gerrit.libreoffice.org/53369 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/source/diff/diff.cxx32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx
index 7d80016b56e4..d94f5e7a1f7f 100644
--- a/test/source/diff/diff.cxx
+++ b/test/source/diff/diff.cxx
@@ -357,8 +357,36 @@ bool XMLDiff::compareAttributes(xmlNodePtr node1, xmlNodePtr node2)
// unequal number of attributes
#ifdef CPPUNIT_ASSERT
- CPPUNIT_ASSERT(!attr1);
- CPPUNIT_ASSERT(!attr2);
+ std::stringstream failStream("Unequal number of attributes ");
+
+ bool bAttr1 = attr1;
+ if (bAttr1)
+ {
+ failStream << "Attr1: ";
+ while (attr1 != nullptr)
+ {
+ xmlChar* val1 = xmlGetProp(node1, attr1->name);
+ failStream << BAD_CAST(attr1->name) << "=" << BAD_CAST(val1) << ", ";
+ xmlFree(val1);
+ attr1 = attr1->next;
+ }
+ }
+ CPPUNIT_ASSERT_MESSAGE(failStream.str(), !bAttr1);
+
+ bool bAttr2 = attr2;
+ if (bAttr2)
+ {
+ failStream << "Attr2: ";
+
+ while (attr2 != nullptr)
+ {
+ xmlChar* val2 = xmlGetProp(node2, attr2->name);
+ failStream << BAD_CAST(attr2->name) << "=" << BAD_CAST(val2) << ", ";
+ xmlFree(val2);
+ attr2 = attr2->next;
+ }
+ }
+ CPPUNIT_ASSERT_MESSAGE(failStream.str(), !bAttr2);
#else
if (attr1 || attr2)
return false;