Skip to content

Quote and escape GrammarFrom's matched text in Display - #47

Merged
isc-klu merged 1 commit into
masterfrom
fix/grammar-from-display-quoting
Sep 4, 2026
Merged

Quote and escape GrammarFrom's matched text in Display#47
isc-klu merged 1 commit into
masterfrom
fix/grammar-from-display-quoting

Conversation

@isc-klu

@isc-klu isc-klu commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Fixes #46

Changes

  • Changed Display for Expectation's GrammarFrom variant to quote and escape from (escape_string), matching how Valid's text field (the same kind of raw matched text) is already treated.

Test Plan

  • Updated display_shows_each_expectation_kind in tests/error_behavior.rs to expect From "999" to SmallNumber: ... instead of the unquoted From 999 to SmallNumber: ....
  • Ran the full matrix locally: fmt --check, clippy (default/no-default-features/all-features), test (all three), doc --all-features.

Notes

Expectation::Valid's `text` field (also raw matched text) is quoted
and escaped via escape_string; GrammarFrom's `from` field wasn't,
printing raw with no quotes and no escaping for control
characters/embedded quotes.

Fixes #46
@isc-klu
isc-klu merged commit 56d20f3 into master Sep 4, 2026
7 checks passed
@isc-klu
isc-klu deleted the fix/grammar-from-display-quoting branch September 4, 2026 20:01
@isc-klu isc-klu mentioned this pull request Sep 4, 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.

GrammarFrom's Display doesn't quote/escape the raw matched text

1 participant