Test: quote Symbol values in @test failure pretty printing#61054
Merged
KristofferC merged 3 commits intoJuliaLang:masterfrom Feb 25, 2026
Merged
Conversation
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.
Member
|
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. |
This was referenced Feb 24, 2026
Keno
reviewed
Feb 25, 2026
Keno
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Symbolvalues inQuoteNodeineval_test_comparisonandeval_test_functionso that@testfailure messages display symbols with the:prefix (e.g.,:syminstead ofsym)Fixes #57287