#define BOOST_TEST_MODULE TestDepend #include #include #include #include #include #include using namespace Gentoo::Utils::Git; BOOST_AUTO_TEST_CASE(gitErrorMessage) { xmlInitParser(); git_libgit2_init(); BOOST_REQUIRE_THROW(gitSafeGet(git_repository_open_ext, git_repository_free, "/", 0, nullptr), Gentoo::GitError); try { gitSafeGet(git_repository_open_ext, git_repository_free, "/", 0, nullptr); } catch (const Gentoo::GitError & ge) { BOOST_TEST_CONTEXT(ge.what()) { BOOST_REQUIRE_EQUAL(ge.errorCode, 1); BOOST_REQUIRE_EQUAL(ge.errorClass, 6); BOOST_REQUIRE(ge.operation.find("git_repository_open_ext") + 1); BOOST_REQUIRE(ge.message.find("repository") + 1); } } xmlCleanupParser(); git_libgit2_shutdown(); } BOOST_AUTO_TEST_CASE(EbuildCacheParser) { Gentoo::Utils::EbuildCacheParser ecp(rootDir / "fixtures" / "accerciser-3.22.0"); BOOST_REQUIRE(!ecp.get("missing")); BOOST_REQUIRE_EQUAL("compile configure install postinst postrm preinst prepare", *ecp.get("DEFINED_PHASES")); BOOST_REQUIRE_EQUAL("0", *ecp.get("SLOT")); BOOST_REQUIRE_EQUAL("d824645ab9e59e46288f40f698baa5e7", *ecp.get("_md5_")); }