mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-12-18 23:11:11 +08:00
Add help option to test command line args
When test binaries are run with unknown options or with the standard -h option, a help menu will print all available options. This is much more convenient than having to dig through unity.c to find every option.
This commit is contained in:
11
src/unity.c
11
src/unity.c
@@ -2329,6 +2329,17 @@ int UnityParseOptions(int argc, char** argv)
|
||||
UnityPrint("ERROR: Unknown Option ");
|
||||
UNITY_OUTPUT_CHAR(argv[i][1]);
|
||||
UNITY_PRINT_EOL();
|
||||
/* fall-through to display help */
|
||||
case 'h':
|
||||
UnityPrint("Options: "); UNITY_PRINT_EOL();
|
||||
UnityPrint("-l List all tests"); UNITY_PRINT_EOL();
|
||||
UnityPrint("-f TEST Only run tests with TEST in the name"); UNITY_PRINT_EOL();
|
||||
UnityPrint("-n TEST Only run tests with TEST in the name"); UNITY_PRINT_EOL();
|
||||
UnityPrint("-h Show this help menu"); UNITY_PRINT_EOL();
|
||||
UnityPrint("-q Quiet/Decrease verbosity"); UNITY_PRINT_EOL();
|
||||
UnityPrint("-v Increase verbosity"); UNITY_PRINT_EOL();
|
||||
UnityPrint("-x TEST Exclude tests with TEST in the name"); UNITY_PRINT_EOL();
|
||||
UNITY_OUTPUT_FLUSH();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user