Skip to content

Preserve complete percent-sign diagnostic output (#217) - #4

Merged
masmgr merged 2 commits into
developfrom
fix/issue-217-percent-signs
Oct 18, 2026
Merged

masmgr merged 2 commits into
developfrom
fix/issue-217-percent-signs

Conversation

@masmgr

@masmgr masmgr commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Preserve complete diagnostic output containing percent signs, with regression coverage for tSQLt-org#217.

The current code already escapes percent signs before RAISERROR, and Fail stores the diagnostic text before raising a fixed tSQLt.Failure message. However, Private_Print escapes the message and then uses its original length to control iteration. Percent signs in earlier lines can therefore cause later lines to be omitted.

Measure the escaped message when iterating over its lines. Public interfaces and table-comparison behavior are unchanged.

Regression coverage:

  • Equal table values containing %, %%, %s, %d, and 100% compare successfully.
  • Unequal values containing percent signs preserve the complete assertion message and raise the normal tSQLt.Failure.
  • Fail preserves percent signs across its message parameters.
  • Private_Print preserves every line after percent signs.

The historical Invalid format specification error in the issue is covered by the assertion and Fail regressions; this implementation fixes the remaining multiline-output defect in the current code.

Validation

  • Diff whitespace checks pass with CRLF treated as the repository's existing line endings.
  • SQL Server 2017 / 2019 / 2022 build and full validation passed: 2,343 tests per version, 0 failures, 0 errors. Downloaded all three XML result artifacts and verified all four new regressions pass for class and DACPAC installations. CI: https://github.com/masmgr/tSQLt/actions/runs/39117838908

Upstream issue: tSQLt-org#217

@masmgr
masmgr merged commit 13e8297 into develop Oct 18, 2026
3 checks passed
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.

1 participant