diff options
Diffstat (limited to 'unittests/config.cpp')
-rw-r--r-- | unittests/config.cpp | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/unittests/config.cpp b/unittests/config.cpp index db7570e..20a025a 100644 --- a/unittests/config.cpp +++ b/unittests/config.cpp @@ -1,10 +1,10 @@ #define BOOST_TEST_MODULE GitFS_Config -#include <boost/test/unit_test.hpp> #include <boost/test/data/test_case.hpp> +#include <boost/test/unit_test.hpp> -#include <definedDirs.h> -#include <compileTimeFormatter.h> #include "mockDefs.h" +#include <compileTimeFormatter.h> +#include <definedDirs.h> using namespace GitFS; using namespace GitFS::Test; @@ -13,34 +13,28 @@ using namespace AdHoc::literals; namespace btdata = boost::unit_test::data; class IdsIce : public IceTray::DryIce { - public: - IdsIce(const char * uid, const char * gid) : IceTray::DryIce({ - "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()), - "--GitFS.testrepo.authkey=%?"_fmt("testauth"), - "--GitFS.testrepo.gid=%?"_fmt(gid), - "--GitFS.testrepo.uid=%?"_fmt(uid), - "--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c930", +public: + IdsIce(const char * uid, const char * gid) : + IceTray::DryIce({ + "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()), + "--GitFS.testrepo.authkey=%?"_fmt("testauth"), + "--GitFS.testrepo.gid=%?"_fmt(gid), + "--GitFS.testrepo.uid=%?"_fmt(uid), + "--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c930", }) - {} + { + } }; -const auto USERS = btdata::make({ "root", "gituser", "www" }); -const auto GROUPS = btdata::make({ "root", "gitgroup", "www" }); -const auto DIRS = btdata::make({ "/", "/src", "/unittests/fixtures" }); -const auto FILES = btdata::make({ - "/Jamroot.jam", "/src/repo.cpp", "/unittests/fixtures/executable" }); -const auto LINKS = btdata::make({ "/unittests/fixtures/symlink" }); -const auto COMMITISHS = btdata::make({ - "", - "master", - "origin/master", - "testcommit", - "7a0ccb40084c3ab31d9856e7f689c0514c28c930" -}); +const auto USERS = btdata::make({"root", "gituser", "www"}); +const auto GROUPS = btdata::make({"root", "gitgroup", "www"}); +const auto DIRS = btdata::make({"/", "/src", "/unittests/fixtures"}); +const auto FILES = btdata::make({"/Jamroot.jam", "/src/repo.cpp", "/unittests/fixtures/executable"}); +const auto LINKS = btdata::make({"/unittests/fixtures/symlink"}); +const auto COMMITISHS + = btdata::make({"", "master", "origin/master", "testcommit", "7a0ccb40084c3ab31d9856e7f689c0514c28c930"}); -BOOST_DATA_TEST_CASE(uid_gid_override_getattr, - USERS * GROUPS * (DIRS + FILES + LINKS), - uid, gid, path) +BOOST_DATA_TEST_CASE(uid_gid_override_getattr, USERS * GROUPS *(DIRS + FILES + LINKS), uid, gid, path) { IdsIce s(uid, gid); VolumeClient c; @@ -51,9 +45,7 @@ BOOST_DATA_TEST_CASE(uid_gid_override_getattr, BOOST_CHECK_EQUAL(attr.gid, gid); } -BOOST_DATA_TEST_CASE(uid_gid_override_fgetattr, - USERS * GROUPS * FILES, - uid, gid, path) +BOOST_DATA_TEST_CASE(uid_gid_override_fgetattr, USERS * GROUPS * FILES, uid, gid, path) { IdsIce s(uid, gid); VolumeClient c; @@ -66,9 +58,7 @@ BOOST_DATA_TEST_CASE(uid_gid_override_fgetattr, file->close(); } -BOOST_DATA_TEST_CASE(uid_gid_override_list, - USERS * GROUPS * DIRS, - uid, gid, path) +BOOST_DATA_TEST_CASE(uid_gid_override_list, USERS * GROUPS * DIRS, uid, gid, path) { IdsIce s(uid, gid); VolumeClient c; @@ -84,12 +74,12 @@ BOOST_DATA_TEST_CASE(uid_gid_override_list, dir->close(); } -BOOST_DATA_TEST_CASE(commitishs, COMMITISHS * (FILES + DIRS), commitish, path) +BOOST_DATA_TEST_CASE(commitishs, COMMITISHS *(FILES + DIRS), commitish, path) { IceTray::DryIce di({ - "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()), - "--GitFS.testrepo.authkey=%?"_fmt("testauth"), - "--GitFS.testrepo.commitish=%?"_fmt(commitish), + "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()), + "--GitFS.testrepo.authkey=%?"_fmt("testauth"), + "--GitFS.testrepo.commitish=%?"_fmt(commitish), }); VolumeClient c; BOOST_CHECK_NO_THROW(c.v->ice_ping()); @@ -99,11 +89,10 @@ BOOST_DATA_TEST_CASE(commitishs, COMMITISHS * (FILES + DIRS), commitish, path) BOOST_DATA_TEST_CASE(bad_commitishs, FILES, commitish) // File paths aren't commitishs { IceTray::DryIce di({ - "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()), - "--GitFS.testrepo.authkey=%?"_fmt("testauth"), - "--GitFS.testrepo.commitish=%?"_fmt(commitish), + "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()), + "--GitFS.testrepo.authkey=%?"_fmt("testauth"), + "--GitFS.testrepo.commitish=%?"_fmt(commitish), }); Client c; BOOST_CHECK_THROW(c.s->connect("testrepo", "testauth"), NetFS::ConfigError); } - |