2015-09-29 14:29:10 +02:00
|
|
|
#include "testutils/ProgramOptionsTestBase.h"
|
|
|
|
#include "../../src/program_options/ProgramOptions.h"
|
|
|
|
|
|
|
|
using namespace cryfs::program_options;
|
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
class ProgramOptionsTest: public ProgramOptionsTestBase {};
|
|
|
|
|
|
|
|
TEST_F(ProgramOptionsTest, BaseDir) {
|
2015-09-29 14:39:10 +02:00
|
|
|
ProgramOptions testobj("/home/user/mydir", "", "", options({"./myExecutable"}));
|
2015-09-29 14:29:10 +02:00
|
|
|
EXPECT_EQ("/home/user/mydir", testobj.baseDir());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(ProgramOptionsTest, MountDir) {
|
2015-09-29 14:39:10 +02:00
|
|
|
ProgramOptions testobj("", "/home/user/mydir", "", options({"./myExecutable"}));
|
2015-09-29 14:29:10 +02:00
|
|
|
EXPECT_EQ("/home/user/mydir", testobj.mountDir());
|
|
|
|
}
|
|
|
|
|
2015-09-29 14:39:10 +02:00
|
|
|
TEST_F(ProgramOptionsTest, ConfigFile) {
|
|
|
|
ProgramOptions testobj("", "", "/home/user/configfile", options({"./myExecutable"}));
|
|
|
|
EXPECT_EQ("/home/user/configfile", testobj.configFile());
|
|
|
|
}
|
|
|
|
|
2015-09-29 14:29:10 +02:00
|
|
|
TEST_F(ProgramOptionsTest, EmptyFuseOptions) {
|
2015-09-29 14:39:10 +02:00
|
|
|
ProgramOptions testobj("/rootDir", "/home/user/mydir", "/home/user/configfile", options({"./myExecutable"}));
|
2015-09-29 14:29:10 +02:00
|
|
|
//Fuse should have the mount dir as first parameter
|
|
|
|
EXPECT_VECTOR_EQ({"./myExecutable", "/home/user/mydir"}, testobj.fuseOptions());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(ProgramOptionsTest, SomeFuseOptions) {
|
2015-09-29 14:39:10 +02:00
|
|
|
ProgramOptions testobj("/rootDir", "/home/user/mydir", "/home/user/configfile", options({"./myExecutable", "-f", "--longoption"}));
|
2015-09-29 14:29:10 +02:00
|
|
|
//Fuse should have the mount dir as first parameter
|
|
|
|
EXPECT_VECTOR_EQ({"./myExecutable", "/home/user/mydir", "-f", "--longoption"}, testobj.fuseOptions());
|
|
|
|
}
|