Author: jkupec
Date: Wed Apr 9 16:17:41 2008
New Revision: 9483
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9483&view=rev
Log:
- check whether regex compiled allright if matchRegex()
- fixed setMatch*() methods
- few tests for regexes added
Modified:
trunk/libzypp/libzypp.spec.cmake
trunk/libzypp/tests/zypp/PoolQuery_test.cc
trunk/libzypp/zypp/PoolQuery.cc
Modified: trunk/libzypp/libzypp.spec.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/libzypp.spec.cmake?rev=9483&r1=9482&r2=9483&view=diff
==============================================================================
--- trunk/libzypp/libzypp.spec.cmake (original)
+++ trunk/libzypp/libzypp.spec.cmake Wed Apr 9 16:17:41 2008
@@ -24,7 +24,7 @@
Provides: yast2-packagemanager
Obsoletes: yast2-packagemanager
BuildRequires: cmake
-BuildRequires: libsatsolver-devel openssl-devel
+BuildRequires: libsatsolver-devel >= 0.0.26 openssl-devel
BuildRequires: boost-devel curl-devel dejagnu doxygen gcc-c++ gettext-devel graphviz hal-devel libxml2-devel
%if 0%{?suse_version}
Modified: trunk/libzypp/tests/zypp/PoolQuery_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/PoolQuery_test.cc?rev=9483&r1=9482&r2=9483&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/PoolQuery_test.cc (original)
+++ trunk/libzypp/tests/zypp/PoolQuery_test.cc Wed Apr 9 16:17:41 2008
@@ -140,7 +140,7 @@
// use globs
BOOST_AUTO_TEST_CASE(pool_query_005)
{
- cout << "****005****" << endl;
+ cout << "****005.1****" << endl;
PoolQuery q;
q.addString("z?p*");
q.addAttribute(sat::SolvAttr::name);
@@ -149,7 +149,7 @@
std::for_each(q.begin(), q.end(), &result_cb);
BOOST_CHECK(q.size() == 11);
- cout << endl;
+ cout << "****005.2****" << endl;
PoolQuery q1;
q1.addString("*zypp*");
@@ -159,6 +159,8 @@
std::for_each(q1.begin(), q1.end(), &result_cb);
BOOST_CHECK(q1.size() == 28);
+ cout << "****005.3****" << endl;
+
// should be the same as above
PoolQuery q2;
q2.addString("zypp");
@@ -167,10 +169,44 @@
BOOST_CHECK(q2.size() == 28);
}
-// match by installed status (basically by system vs. repo)
+// use regex
BOOST_AUTO_TEST_CASE(pool_query_006)
{
- cout << "****006****" << endl;
+ cout << "****006.1***" << endl;
+
+ // should be the same as 005 1
+ PoolQuery q;
+ q.addString("^z.p.*");
+ q.addAttribute(sat::SolvAttr::name);
+ q.setMatchRegex();
+
+ std::for_each(q.begin(), q.end(), &result_cb);
+ BOOST_CHECK(q.size() == 11);
+
+ cout << "****006.2***" << endl;
+
+ PoolQuery q1;
+ q1.addString("zypper|smart");
+ q1.addAttribute(sat::SolvAttr::name);
+ q1.setMatchRegex();
+
+ std::for_each(q1.begin(), q1.end(), &result_cb);
+ BOOST_CHECK(q1.size() == 21);
+
+ cout << "****006.3***" << endl;
+
+ // invalid regex
+ PoolQuery q2;
+ q2.addString("zypp\\");
+ q2.setMatchRegex();
+ BOOST_CHECK_THROW(q2.size(), Exception);
+}
+
+
+// match by installed status (basically by system vs. repo)
+BOOST_AUTO_TEST_CASE(pool_query_050)
+{
+ cout << "****050****" << endl;
PoolQuery q;
q.addString("zypper");
q.addAttribute(sat::SolvAttr::name);
@@ -263,7 +299,6 @@
q.setMatchGlob();
std::for_each(q.begin(), q.end(), &result_cb);
- cout << q.size() << endl;
BOOST_CHECK(q.size() == 35);
}
Modified: trunk/libzypp/zypp/PoolQuery.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/PoolQuery.cc?rev=9483&r1=9482&r2=9483&view=diff
==============================================================================
--- trunk/libzypp/zypp/PoolQuery.cc (original)
+++ trunk/libzypp/zypp/PoolQuery.cc Wed Apr 9 16:17:41 2008
@@ -16,6 +16,7 @@
#include <algorithm>
#include