Multi line error message and NULL pointer fixes#114
Merged
pks-t merged 2 commits intoclar-test:mainfrom Feb 21, 2025
Merged
Conversation
When printing error messages and descriptions indent all the lines rather than just the first line. When the tests are run with --tap this ensures that the yaml snippet in the TAP output is valid. The new test uses cl_must_pass() but multi-line error descriptions are also likely to be created by cl_assert_equal_s().
Passing a NULL pointer as the argument to a "%s" format specifier is undefined according to the C standard. In practice glibc and some other implementations accept NULL and print "(null)" but such behavior cannot be relied upon by portable code. To avoid any ambiguity with the string "NULL" NULL pointers are printed "NULL" without the single quotes that surround the text of non-NULL strings.
pks-t
approved these changes
Feb 8, 2025
Member
pks-t
left a comment
There was a problem hiding this comment.
Thanks, both of these changes make sense to me.
Contributor
Author
|
@pks-t Thanks for the reviewing and merging these |
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.
Indent all the lines in error messages and descriptions to ensure that the YAML embedded in TAP output is valid and fix an issue with passing NULL pointers to snprintf(). I've bundled these together as I couldn't figure out how to update the tests in two separate PR's without creating conflicts when they are both merged.