diff --git a/src/program_options/Parser.cpp b/src/program_options/Parser.cpp index 4ef86fd4..e758b2f6 100644 --- a/src/program_options/Parser.cpp +++ b/src/program_options/Parser.cpp @@ -7,6 +7,7 @@ using namespace cryfs::program_options; using std::pair; using std::vector; using std::cerr; +using std::endl; using std::string; Parser::Parser(int argc, char *argv[]) :_options(_argsToVector(argc, argv)) {} @@ -81,6 +82,6 @@ void Parser::_addPositionalOptionForBaseDir(po::options_description *desc, po::p cerr << "Usage: cryfs --config configFile [other options] rootDir mountPoint [-- [FUSE Mount Options]]\n"; po::options_description desc; _addAllowedOptions(&desc); - cerr << desc << "\n"; + cerr << desc << endl; exit(1); } diff --git a/src/program_options/ProgramOptions.h b/src/program_options/ProgramOptions.h index 2b86c81f..02d3bdbc 100644 --- a/src/program_options/ProgramOptions.h +++ b/src/program_options/ProgramOptions.h @@ -7,7 +7,7 @@ namespace cryfs { namespace program_options { - class ProgramOptions { + class ProgramOptions final { public: ProgramOptions(const std::string &baseDir, const std::string &mountDir, const std::string &configFile, bool foreground, const std::vector &fuseOptions); ~ProgramOptions(); diff --git a/test/program_options/ParserTest.cpp b/test/program_options/ParserTest.cpp index a9b0814a..ee468fcc 100644 --- a/test/program_options/ParserTest.cpp +++ b/test/program_options/ParserTest.cpp @@ -12,35 +12,38 @@ public: } }; -TEST_F(ProgramOptionsParserTest, MissingAllOptions) { +class ProgramOptionsParserDeathTest: public ProgramOptionsParserTest {}; + +TEST_F(ProgramOptionsParserDeathTest, MissingAllOptions) { EXPECT_DEATH( - parse({"./myExecutable"}), - "Usage:" + parse({"./myExecutable"}), + "Usage:" ); + std::cout << "exited" << std::endl; } -TEST_F(ProgramOptionsParserTest, MissingDir) { +TEST_F(ProgramOptionsParserDeathTest, MissingDir) { EXPECT_DEATH( parse({"./myExecutable", "/home/user/baseDir"}), "Usage:" ); } -TEST_F(ProgramOptionsParserTest, ConfigFileMissing) { +TEST_F(ProgramOptionsParserDeathTest, ConfigFileMissing) { EXPECT_DEATH( parse({"./myExecutable", "/home/user/baseDir", "/home/user/mountDir"}), "Usage:" ); } -TEST_F(ProgramOptionsParserTest, HelpLongOption) { +TEST_F(ProgramOptionsParserDeathTest, HelpLongOption) { EXPECT_DEATH( parse({"./myExecutable", "--help"}), "Usage:" ); } -TEST_F(ProgramOptionsParserTest, HelpShortOption) { +TEST_F(ProgramOptionsParserDeathTest, HelpShortOption) { EXPECT_DEATH( parse({"./myExecutable", "-h"}), "Usage:"