Skip to content

Test: quote Symbol values in @test failure pretty printing#61054

Merged
KristofferC merged 3 commits intoJuliaLang:masterfrom
apoorvdarshan:ad/fix-test-symbol-pretty-printing
Feb 25, 2026
Merged

Test: quote Symbol values in @test failure pretty printing#61054
KristofferC merged 3 commits intoJuliaLang:masterfrom
apoorvdarshan:ad/fix-test-symbol-pretty-printing

Conversation

@apoorvdarshan
Copy link
Contributor

@apoorvdarshan apoorvdarshan commented Feb 17, 2026

Summary

  • Wrap Symbol values in QuoteNode in eval_test_comparison and eval_test_function so that @test failure messages display symbols with the : prefix (e.g., :sym instead of sym)
  • Add tests for symbol comparison and symbol-in-function-call failure pretty printing

Fixes #57287

When `@test` fails on an expression involving Symbol values, the
"Evaluated" line prints the symbol without the `:` prefix, making it
look like an identifier rather than a symbol literal. For example,
`@test x == :sym` would show `Evaluated: 1 == sym` instead of the
correct `Evaluated: 1 == :sym`.

Wrap Symbol values in `QuoteNode` in both `eval_test_comparison` and
`eval_test_function` so that symbols are displayed with the `:` prefix
when printing the evaluated expression.

Fixes JuliaLang#57287
[Test] quote AST values in `@test` failure pretty printing

When `@test` fails on an expression involving AST types, such as
Symbols, the "Evaluated" line prints the expression without the `:`
prefix, making it look incorrect. For example, `@test x == :sym` would
show `Evaluated: 1 == sym` instead of the expected
`Evaluated: 1 == :sym`.

The helper `Base.quoted` exists for exactly this purpose, so use it in
both `eval_test_comparison` and `eval_test_function` so that AST types
are displayed correctly with the `:` prefix when printing the evaluated
expression.
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Feb 24, 2026
@vtjnash
Copy link
Member

vtjnash commented Feb 24, 2026

Added a variety of other related fixes, so that we aren't just playing whack-a-mole with awkward-specific pattern matching from issue to PR. Should be safe to merge now.

@KristofferC KristofferC merged commit bc7c2e0 into JuliaLang:master Feb 25, 2026
6 of 8 checks passed
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Feb 25, 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.

Failure to quote symbols in pretty printing in @test failures

6 participants