projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http_rewrite: rename Section -> Phase
[metaproxy-moved-to-github.git]
/
src
/
test_xmlutil.cpp
diff --git
a/src/test_xmlutil.cpp
b/src/test_xmlutil.cpp
index
ae9b571
..
c89c0f9
100644
(file)
--- a/
src/test_xmlutil.cpp
+++ b/
src/test_xmlutil.cpp
@@
-1,5
+1,5
@@
/* This file is part of Metaproxy.
/* This file is part of Metaproxy.
- Copyright (C) 2005-2011 Index Data
+ Copyright (C) 2005-2013 Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-36,9
+36,9
@@
namespace mp_xml = metaproxy_1::xml;
BOOST_AUTO_TEST_CASE( url_recipe )
{
BOOST_AUTO_TEST_CASE( url_recipe )
{
- try
+ try
{
{
- const char *xml_text =
+ const char *xml_text =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<pz:record xmlns:pz=\"http://www.indexdata.com/pazpar2/1.0\""
" xmlns:tmarc=\"http://www.indexdata.com/turbomarc\">\n"
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<pz:record xmlns:pz=\"http://www.indexdata.com/pazpar2/1.0\""
" xmlns:tmarc=\"http://www.indexdata.com/turbomarc\">\n"
@@
-63,39
+63,41
@@
BOOST_AUTO_TEST_CASE( url_recipe )
BOOST_CHECK(!res.compare("abc"));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[no/yes]}");
BOOST_CHECK(!res.compare("abc"));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[no/yes]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare("yes"));
BOOST_CHECK(!res.compare("yes"));
+ res = mp_xml::url_recipe_handle(doc, "<${has-fulltext[no/yes]}>");
+ BOOST_CHECK(!res.compare("<yes>"));
+
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[no]}");
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[no]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare(""));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[no/]}");
BOOST_CHECK(!res.compare(""));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[no/]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare(""));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[n/]}");
BOOST_CHECK(!res.compare(""));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext[n/]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare("o"));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext}");
BOOST_CHECK(!res.compare("o"));
res = mp_xml::url_recipe_handle(doc, "${has-fulltext}");
- std::cout << "res=" << res << std::endl;
+ BOOST_CHECK(!res.compare("no"));
+
+ res = mp_xml::url_recipe_handle(doc, "%{has-fulltext}");
BOOST_CHECK(!res.compare("no"));
res = mp_xml::url_recipe_handle(
doc, "http://sever.com?title=${md-title[\\s+/+/g]}");
BOOST_CHECK(!res.compare("no"));
res = mp_xml::url_recipe_handle(
doc, "http://sever.com?title=${md-title[\\s+/+/g]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare("http://sever.com?title=How+to+program+a+computer"));
BOOST_CHECK(!res.compare("http://sever.com?title=How+to+program+a+computer"));
+ res = mp_xml::url_recipe_handle(
+ doc, "http://sever.com?title=%{md-title}");
+ BOOST_CHECK(!res.compare("http://sever.com?title=How%20to%20program%20a%20computer"));
+
+
res = mp_xml::url_recipe_handle(doc, "${md-id[2/1]}");
res = mp_xml::url_recipe_handle(doc, "${md-id[2/1]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare(" 11124466 "));
res = mp_xml::url_recipe_handle(doc, "${md-id[2/1/g]}");
BOOST_CHECK(!res.compare(" 11124466 "));
res = mp_xml::url_recipe_handle(doc, "${md-id[2/1/g]}");
- std::cout << "res=" << res << std::endl;
BOOST_CHECK(!res.compare(" 11114466 "));
BOOST_CHECK(!res.compare(" 11114466 "));
-
xmlFreeDoc(doc);
}
}
xmlFreeDoc(doc);
}
}