提交 5e401afa 编写于 作者: J James Hood

updating CLI for unity_fixture.h to handle unknown command line arguments...

updating CLI for unity_fixture.h to handle unknown command line arguments (instead of entering an infinite loop)
上级 b8d47ff2
......@@ -351,6 +351,9 @@ int UnityGetCommandLineOptions(int argc, char* argv[])
i++;
}
}
} else {
// ignore unknown parameter
i++;
}
}
return 0;
......
......@@ -255,6 +255,23 @@ TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified)
TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount);
}
static char* unknownCommand[] = {
"testrunner.exe",
"-v",
"-g", "groupname",
"-n", "testname",
"-r", "98",
"-z"
};
TEST(UnityCommandOptions, UnknownCommandIsIgnored)
{
TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(9, unknownCommand));
TEST_ASSERT_EQUAL(1, UnityFixture.Verbose);
STRCMP_EQUAL("groupname", UnityFixture.GroupFilter);
STRCMP_EQUAL("testname", UnityFixture.NameFilter);
TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount);
}
//------------------------------------------------------------
......
......@@ -30,6 +30,7 @@ TEST_GROUP_RUNNER(UnityCommandOptions)
RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount);
RUN_TEST_CASE(UnityCommandOptions, MultipleOptions);
RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified);
RUN_TEST_CASE(UnityCommandOptions, UnknownCommandIsIgnored);
}
TEST_GROUP_RUNNER(LeakDetection)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册