Open
Conversation
Resolves mity#33 - Defaults to TEST_MSG_MAXSIZE as normal. - Adds new usage line in --help output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intro
Thank you @mity for a great tool that I use for every bit of C I work with.
I wanted to get into contributing to open source projects for practice and internet points. Working on something I have a passion for and am familiar with seemed like a good place to start.
I have implemented the cmd line option for changing message output limit at run-time.
Resolves #33
New features
Added run-time option to change the max output message length without having to recompile. Features:
--max-msg=NUMBERTEST_MSG_MAXSIZEis kept and used as default. It can still be defined before acutest include.--helpline for--max-msgusageTested with:
x64 Windows: gcc -Wall -Wextra -pedantic.
Recreate issue and Verify solution
A test rig was setup to recreate a character limited test message.
Length of test message was larger than
TEST_MSG_MAXSIZE(1024), increased to (1024 + 200 - 24) = 1200 characters (for a nice round number).On a failing test, as shown below, the # symbols represent long
TEST_MSGoutput. As expected, the character count is 1024 - 1 (null terminated), defined byTEST_MSG_MAXSIZE. It does not show the final sentence, confirming the long message output is limited by the compile-time defined value.Normal default length limited output:

Using the new run-time option
--max-msg=1200, the full message can be seen without having to recompile. It includes the closing words right up to the final period, verifying intended behaviour.Run-time option extended output:

Re-compiling with pre-defined
TEST_MSG_MAXSIZE 1200is confirmed to still operate as expected, needing no option to show full message.Compile-time define extended output:

Bad input argument behaviour
There are several possible arg errors, nonsense input or genuine user misunderstanding. eg. user could misinterpret "--max-msg" is to set max possible etc. To handle these type of cases, the
acutest_cmdline_options_argument field was set toACUTEST_CMDLINE_OPTFLAG_REQUIREDARG_. Other bad input is handled by setting exit value and usage hint output, matching other options.Bad arg outputs:
--helpoptions output includes--max-msgline:Conclusion
This implementation meets requirements and is sufficiently verified for expected behaviour and error handling (IMO). I have not tested on other machines although I do not see these changes causing any problem. I will provide an update if anything arises from that testing.
Issue #34 is an equivalent feature for TEST_DUMP_MAXSIZE. I think it would be best to have that implemented for consistency. I'm happy to do that one next.