mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-20 22:13:29 +08:00
Merge pull request #34 from hoodja/master
Unknown CLI params get ignored
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user