aboutsummaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-04 22:18:06 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-05 15:46:55 +0200
commit33de2a7e03aafd6c3f57031dee7033be3b131c7a (patch)
treef6e3f63cb9daa3728e6016c9e0d2fa1e45d0195d /document
parentd3ed38df6ae6dbdb0143fd20e8dd546da0c60bf3 (diff)
Test iterations with arryIndex
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/documenttestcase.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp
index 33d1a666d4a..ee49259e982 100644
--- a/document/src/tests/documenttestcase.cpp
+++ b/document/src/tests/documenttestcase.cpp
@@ -115,16 +115,22 @@ public:
~Handler();
const std::string & getResult() const { return _result; }
private:
- void onPrimitive(uint32_t, const Content&) override { _result += 'P'; }
+ void onPrimitive(uint32_t, const Content&) override {
+ std::ostringstream os; os << "P-" << getArrayIndex();
+ _result += os.str();
+ }
void onCollectionStart(const Content&) override { _result += '['; }
void onCollectionEnd(const Content&) override { _result += ']'; }
- void onStructStart(const Content&) override { _result += '<'; }
+ void onStructStart(const Content&) override {
+ std::ostringstream os; os << "<" << getArrayIndex() << ":";
+ _result += os.str();
+ }
void onStructEnd(const Content&) override { _result += '>'; }
std::string _result;
};
-Handler::Handler() { }
-Handler::~Handler() { }
+Handler::Handler() = default;
+Handler::~Handler() = default;
void DocumentTest::testTraversing()
@@ -186,7 +192,7 @@ void DocumentTest::testTraversing()
FieldPath empty;
doc.iterateNested(empty.getFullRange(), fullTraverser);
CPPUNIT_ASSERT_EQUAL(fullTraverser.getResult(),
- std::string("<P<P<PP[PPP][<PP><PP>]>>>"));
+ std::string("<0:P-0<0:P-0<0:P-0P-0[P-0P-1P-2][<0:P-0P-0><1:P-1P-1>]>>>"));
}
class VariableIteratorHandler : public IteratorHandler {