diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-05-02 00:17:43 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-05-02 00:17:43 +0100 |
commit | db5f17c4ee208a4523aebc8715554f273607d792 (patch) | |
tree | 99fbd620d600b8a32781c5822aaedb4cb451d59e | |
parent | Update to new PluginMock interface (diff) | |
download | gentoobrowse-api-db5f17c4ee208a4523aebc8715554f273607d792.tar.bz2 gentoobrowse-api-db5f17c4ee208a4523aebc8715554f273607d792.tar.xz gentoobrowse-api-db5f17c4ee208a4523aebc8715554f273607d792.zip |
Make testDependAll more generic ready for other things
-rw-r--r-- | gentoobrowse-api/unittests/Jamfile.jam | 6 | ||||
-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")); |