#5657 Added serial argument parsing unit test

This commit is contained in:
Jerry (Xinyu Hou) 2016-10-14 13:51:46 +01:00
parent 92b29276d0
commit 2b1b0640ea
1 changed files with 14 additions and 0 deletions

View File

@ -64,3 +64,17 @@ TEST(ServerArgsParsingTests, parseServerArgs_configArg_setConfigFile)
EXPECT_EQ("mock_configFile", serverArgs.m_configFile);
}
TEST(ServerArgsParsingTests, parseServerArgs_serialArg_setSerial)
{
NiceMock<MockArgParser> argParser;
ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(server_stubParseGenericArgs));
ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(server_stubCheckUnexpectedArgs));
ServerArgs serverArgs;
const int argc = 3;
const char* kSerialCmd[argc] = { "stub", "--serial-key", "mock_serial" };
argParser.parseServerArgs(serverArgs, argc, kSerialCmd);
EXPECT_EQ("mock_serial", serverArgs.m_serial);
}