Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help option to test command line args #706

Merged

Conversation

Skinner927
Copy link
Contributor

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.

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.
@HaorongX
Copy link

HaorongX commented Dec 3, 2023

Great idea. I also found it confusing when I have to check unity.c to find these options. I think the usage should be added to docs at the same time. ^_^

Copy link
Member

@mvandervoord mvandervoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the awesome addition! I really appreciate the work. I have a couple minor suggested tweaks, if you don't mind?

src/unity.c Outdated
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change the wording to make it obvious what the function letter is? Something like "Filter to run only tests with TEST in the name"?

Copy link
Contributor Author

@Skinner927 Skinner927 Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the options. If you'd prefer to choose exactly what to say I won't be offended.

P.S. TY for the timely review.

src/unity.c Outdated
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd not include the n option... or if I did include it, mark it as deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ git blame -L2289,2290 src/unity.c
4d3d062b (Mark VanderVoord 2016-06-21 16:07:10 -0400 2289)                 case 'n': /* include tests with name including this string */
1cecab30 (Mark VanderVoord 2016-07-08 17:35:37 -0400 2290)                 case 'f': /* an alias for -n */

It's still there, but yes, it would appear you later preferred -f. -f is a better mnemonic for filter anyways.

"Options:",
"-l List all tests",
"-f TEST Only run tests with TEST in the name",
"-n TEST Only run tests with TEST in the name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked as depreciated. I can remove it if you'd prefer.

@mvandervoord mvandervoord merged commit da5a45b into ThrowTheSwitch:master Dec 4, 2023
4 checks passed
@Skinner927 Skinner927 deleted the add-help-to-test-binaries branch December 6, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants