From 9c839505dded4db5c9daea9f1ab67728d6646406 Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 16 Sep 2008 08:31:30 +0100 Subject: [PATCH] added more text node tests --- examples/XSLT/mangle.cpp | 2 +- tests/XPath/text_node_test.hpp | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/examples/XSLT/mangle.cpp b/examples/XSLT/mangle.cpp index 263ee69c..c44705a3 100755 --- a/examples/XSLT/mangle.cpp +++ b/examples/XSLT/mangle.cpp @@ -42,7 +42,7 @@ int main(int argc, const char* argv[]) std::cerr << "Could not parse XML source" << std::endl; return 0; } // if ... - document.normalize(); + //document.normalize(); stylesheet->execute(document); /* diff --git a/tests/XPath/text_node_test.hpp b/tests/XPath/text_node_test.hpp index f38bfa70..58e54f66 100755 --- a/tests/XPath/text_node_test.hpp +++ b/tests/XPath/text_node_test.hpp @@ -55,7 +55,7 @@ public: assertTrue(node == root_); } // test1 - void test2() + void testTextTest() { XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/text()"), document_); assertEquals(1, nodes.asNodeSet().size()); @@ -79,12 +79,28 @@ public: assertEquals("onetwothree", SA::asStdString(value)); } // test5 - void test6() + void testNodeTest() { XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/root/node()"), document_); assertEquals(1, nodes.asNodeSet().size()); - } // test6 + } // testNodeTest + void testDescendantOrSelf() + { + XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("//text()"), document_); + assertEquals(1, nodes.asNodeSet().size()); + } // testDescendantOrSelf + + void testDescendant() + { + XPathValue_t nodes = parser_.evaluate(SA::construct_from_utf8("/descendant::text()"), document_); + assertEquals(1, nodes.asNodeSet().size()); + } // testDescendant + + // FOLLOWING + // FOLLOWING_SIBLING + // PRECEDING + // PRECEDING_SIBLING }; // class TextNodeTest template @@ -93,11 +109,13 @@ TestSuite* TextNodeTest_suite() TestSuite* suiteOfTests = new TestSuite; suiteOfTests->addTest(new TestCaller >("test1", &TextNodeTest::test1)); - suiteOfTests->addTest(new TestCaller >("test2", &TextNodeTest::test2)); + suiteOfTests->addTest(new TestCaller >("testTextTest", &TextNodeTest::testTextTest)); suiteOfTests->addTest(new TestCaller >("test3", &TextNodeTest::test3)); suiteOfTests->addTest(new TestCaller >("test4", &TextNodeTest::test4)); suiteOfTests->addTest(new TestCaller >("test5", &TextNodeTest::test5)); - suiteOfTests->addTest(new TestCaller >("test6", &TextNodeTest::test6)); + suiteOfTests->addTest(new TestCaller >("testNodeTest", &TextNodeTest::testNodeTest)); + suiteOfTests->addTest(new TestCaller >("testDescendantOrSelf", &TextNodeTest::testDescendantOrSelf)); + suiteOfTests->addTest(new TestCaller >("testDescendant", &TextNodeTest::testDescendant)); return suiteOfTests; } // TextNodeTest