Skip to content

Escape control bytes with --invisibles - #3249

Open
wozhenbang2004 wants to merge 4 commits into
catchorg:develfrom
wozhenbang2004:1928-escape-control-characters
Open

wozhenbang2004 wants to merge 4 commits into
catchorg:develfrom
wozhenbang2004:1928-escape-control-characters

Conversation

@wozhenbang2004

Copy link
Copy Markdown

Description

--invisibles still writes NUL, BEL, ESC and other control bytes directly into string comparison failures. Depending on the terminal, strings that differ only in these bytes can look identical.

Escape ASCII control bytes when this option is enabled, using short escapes where available and \xNN for the rest. Default output and non-ASCII bytes stay unchanged. The CLI help and documentation now describe the expanded behavior.

The new stringification cases fail before the change, and all 82 CTest tests from the basic-tests preset pass. A real test executable now prints "abc\0" == "abc" with --invisibles; its output without the flag is byte-identical to the original version.

GitHub Issues

Closes #1928.

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.

Comparison failures should display unprintable characters in strings

1 participant