#1719 Fix issue with commands without parameters in command file

This commit is contained in:
Bjørnar Grip Fjær
2017-08-04 13:58:32 +02:00
parent 37456bfa9b
commit 5e48494c9b
2 changed files with 61 additions and 23 deletions

View File

@@ -117,6 +117,12 @@ TEST(RicfCommands, ErrorMessages)
EXPECT_EQ((size_t)2, objects.size());
EXPECT_EQ((size_t)5, errors.m_messages.size());
// Errors should be:
// Line 1 : TesCommand1 does not exist
// Line 2 : Unreadable value for argument IntArgument
// Line 3 : Can't find = after argument named TextA (space withing argument name)
// Line 4 : Can't find = after argument named DoubleArgument
// Line 5 : Missing quotes around TextArgument value
for (const auto& msg: errors.m_messages)
{
@@ -137,3 +143,25 @@ TEST(RicfCommands, ErrorMessages)
delete(obj);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RicfCommands, EmptyArgumentList)
{
// Ensure no error messages when command with no arguments is read
QString commandString("TestCommand1()");
QTextStream inputStream(&commandString);
RicfMessages errors;
auto objects = RicfCommandFileReader::readCommands(inputStream, caf::PdmDefaultObjectFactory::instance(), &errors);
EXPECT_EQ((size_t)1, objects.size());
EXPECT_EQ((size_t)0, errors.m_messages.size());
for (auto obj : objects)
{
delete(obj);
}
}