summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/unittests/Jamfile.jam6
-rw-r--r--gentoobrowse-api/unittests/testProcessAll.cpp (renamed from gentoobrowse-api/unittests/testDependAll.cpp)17
2 files changed, 11 insertions, 12 deletions
diff --git a/gentoobrowse-api/unittests/Jamfile.jam b/gentoobrowse-api/unittests/Jamfile.jam
index 0df060c..94f2b89 100644
--- a/gentoobrowse-api/unittests/Jamfile.jam
+++ b/gentoobrowse-api/unittests/Jamfile.jam
@@ -69,13 +69,13 @@ run
<library>testCommon
: testMasks ;
-explicit testDependAll ;
+explicit testProcessAll ;
run
- testDependAll.cpp ../service/utils/ebuildCacheParser.cpp ../service/depend.cpp
+ testProcessAll.cpp ../service/utils/ebuildCacheParser.cpp ../service/depend.cpp
: : :
<define>BOOST_TEST_DYN_LINK
<library>testCommon
- : testDependAll ;
+ ;
run
testNews.cpp ../service/news.cpp
diff --git a/gentoobrowse-api/unittests/testDependAll.cpp b/gentoobrowse-api/unittests/testProcessAll.cpp
index 5fe0364..cd72a8c 100644
--- a/gentoobrowse-api/unittests/testDependAll.cpp
+++ b/gentoobrowse-api/unittests/testProcessAll.cpp
@@ -1,4 +1,4 @@
-#define BOOST_TEST_MODULE TestDependAll
+#define BOOST_TEST_MODULE TestProcessAll
#include <boost/test/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
@@ -16,19 +16,18 @@ testDependRange(const std::optional<std::string_view> & r)
}
auto
-getFileList()
+getFileList(const boost::filesystem::path & root, bool(*pred)(const boost::filesystem::path &))
{
std::vector<boost::filesystem::path> paths;
- for (boost::filesystem::recursive_directory_iterator d("/usr/portage/metadata/md5-cache");
- d != boost::filesystem::recursive_directory_iterator(); d++) {
- if (boost::filesystem::is_regular_file(d->status())) {
- paths.push_back(*d);
- }
- }
+ std::copy_if(boost::filesystem::recursive_directory_iterator(root),
+ boost::filesystem::recursive_directory_iterator(),
+ std::back_inserter(paths), pred);
return paths;
}
-BOOST_DATA_TEST_CASE( processAll, boost::unit_test::data::make(getFileList()), path )
+BOOST_DATA_TEST_CASE( ebuildCacheDependencies, boost::unit_test::data::make(
+ getFileList("/usr/portage/metadata/md5-cache", boost::filesystem::is_regular_file)),
+ path )
{
Gentoo::Utils::EbuildCacheParser ecp(path);
testDependRange(ecp.getRange("DEPEND"));