Skip to content

Use Unicode Control Pictures for special characters in assertions#2734

Merged
nohwnd merged 3 commits into
mainfrom
fix/2732-printable-chars
Jun 23, 2026
Merged

Use Unicode Control Pictures for special characters in assertions#2734
nohwnd merged 3 commits into
mainfrom
fix/2732-printable-chars

Conversation

@nohwnd

@nohwnd nohwnd commented Jun 18, 2026

Copy link
Copy Markdown
Member

Fixes #2732

Replace \n, \r, \t, \0, \b escape sequences in assertion error messages with visible Unicode Control Pictures (U+2400 block): , , , , .

This reuses the existing [Pester.Formatter]::EscapeControlChars() C# implementation (added for #2561) instead of the PowerShell regex chain. The glyphs are single characters, making arrow markers in diff output align correctly without doubling positions.

nohwnd and others added 3 commits June 18, 2026 14:06
Replace \n, \r, \t etc. with visible Unicode glyphs (U+2400 block)
in Expand-SpecialCharacters, reusing the existing C# implementation
in [Pester.Formatter]::EscapeControlChars().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rs in tests

Control pictures are 1-to-1 replacements (1 char -> 1 char), so the
expanded diff index equals the original. Remove the second scan loop
from Be.ps1 and Should-BeString.ps1.

Use actual Unicode control picture characters in test expectations
instead of [char]0x24XX expressions so the expected output is readable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd

nohwnd commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines successfully started running 1 pipeline(s).

@nohwnd nohwnd merged commit 04a729f into main Jun 23, 2026
13 checks passed
@nohwnd nohwnd deleted the fix/2732-printable-chars branch June 23, 2026 13:06
@nohwnd nohwnd added this to the 6.0.0 milestone Jun 23, 2026
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.

show printable characters instead of \n

1 participant