diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:27:51 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:27:51 +0000 |
commit | e08c065820d734d4f5768470ed6a4f123cbb56ef (patch) | |
tree | c28a4c58b36cd0cd48841617a6a6fc3f8ce350df /tests/test_xpath_api.cpp | |
parent | 7554e206885a3f3aa1a771f0d4ca1d4a921994ad (diff) |
tests: Added XPath tests for attribute context
git-svn-id: http://pugixml.googlecode.com/svn/trunk@664 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_api.cpp')
-rw-r--r-- | tests/test_xpath_api.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp index 8fc4d94..b91910a 100644 --- a/tests/test_xpath_api.cpp +++ b/tests/test_xpath_api.cpp @@ -147,6 +147,25 @@ TEST_XML(xpath_api_evaluate, "<node attr='3'/>") CHECK(ns.size() == 1 && ns[0].attribute() == doc.child(STR("node")).attribute(STR("attr"))); } +TEST_XML(xpath_api_evaluate_attr, "<node attr='3'/>") +{ + xpath_query q(STR(".")); + xpath_node n(doc.child(STR("node")).attribute(STR("attr")), doc.child(STR("node"))); + + CHECK(q.evaluate_boolean(n)); + CHECK(q.evaluate_number(n) == 3); + + char_t string[3]; + CHECK(q.evaluate_string(string, 3, n) == 2 && string[0] == '3' && string[1] == 0); + +#ifndef PUGIXML_NO_STL + CHECK(q.evaluate_string(n) == STR("3")); +#endif + + xpath_node_set ns = q.evaluate_node_set(n); + CHECK(ns.size() == 1 && ns[0] == n); +} + #ifdef PUGIXML_NO_EXCEPTIONS TEST_XML(xpath_api_evaluate_fail, "<node attr='3'/>") { @@ -288,6 +307,4 @@ TEST(xpath_api_exception_what) } #endif -// $$$ -// out of memory during parsing/execution (?) #endif |