container: root: add getter for dfi's root path
Adds impl/test for getting absolute path to all `dfi`'s `root` code.
This commit is contained in:
@@ -255,6 +255,16 @@ std::string get_env(const std::string& var)
|
||||
return std::string{env};
|
||||
}
|
||||
|
||||
//! \brief Get `dfi`'s root-related code directory
|
||||
//! \details Operating system path to where all `dfi` root-related code resides
|
||||
//! \return Operating system absolute path (with trailing slash)
|
||||
//! \exception type::RuntimeError if unable to get environment
|
||||
//! \since docker-finance 1.1.0
|
||||
std::string get_root_path()
|
||||
{
|
||||
return get_env("DOCKER_FINANCE_CONTAINER_REPO") + "/src/root/";
|
||||
}
|
||||
|
||||
//! \brief Execute a command in operating system shell
|
||||
//! \param cmd Operating system shell command [args]
|
||||
//! \return Return value of command
|
||||
|
||||
@@ -327,6 +327,14 @@ TEST_F(CommonFree, get_env)
|
||||
ASSERT_NO_THROW(common::get_env("DOCKER_FINANCE_VERSION"));
|
||||
}
|
||||
|
||||
TEST_F(CommonFree, get_root_path)
|
||||
{
|
||||
ASSERT_NO_THROW(common::get_root_path());
|
||||
ASSERT_EQ(
|
||||
common::get_root_path(),
|
||||
common::get_env("DOCKER_FINANCE_CONTAINER_REPO") + "/src/root/");
|
||||
}
|
||||
|
||||
TEST_F(CommonFree, exec)
|
||||
{
|
||||
ASSERT_NE(common::exec("should-not-exist"), 0);
|
||||
|
||||
Reference in New Issue
Block a user