Graceful exiting when password is wrong
This commit is contained in:
parent
daa4f0a7f3
commit
4164c2353e
@ -35,7 +35,7 @@ CryConfigFile CryConfigLoader::_loadConfig(const bf::path &filename) {
|
||||
auto config = CryConfigFile::load(filename, password);
|
||||
if (config == none) {
|
||||
std::cerr << "Could not load config file. Wrong password?" << std::endl;
|
||||
abort(); // TODO Use exit() once gtest can handle that
|
||||
exit(1);
|
||||
}
|
||||
return std::move(*config);
|
||||
}
|
||||
|
@ -68,8 +68,9 @@ TEST_F(CryConfigLoaderTest, DoesntCrashIfExisting) {
|
||||
|
||||
TEST_F(CryConfigLoaderTest, DoesntLoadIfWrongPassword) {
|
||||
Create("mypassword");
|
||||
EXPECT_DEATH(
|
||||
EXPECT_EXIT(
|
||||
Load("mypassword2"),
|
||||
::testing::ExitedWithCode(1),
|
||||
"Wrong password"
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user