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

Multi line error message and NULL pointer fixes #114

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

phillipwood
Copy link

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.

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 pks-t requested review from pks-t and ethomson February 8, 2025 07:12
Copy link
Member

@pks-t pks-t left a comment

Choose a reason for hiding this comment

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

Thanks, both of these changes make sense to me.

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.

2 participants