Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize test failure display #55925

Open
jariji opened this issue Sep 29, 2024 · 1 comment
Open

Customize test failure display #55925

jariji opened this issue Sep 29, 2024 · 1 comment
Labels
testsystem The unit testing framework and Test stdlib

Comments

@jariji
Copy link
Contributor

jariji commented Sep 29, 2024

I like how it shows the values of y and x here

julia> @test y < x
Test Failed at REPL[6]:1
  Expression: y < x
   Evaluated: 2 < 1

I would like to make it do that for custom functions.

julia> eq(x,y) = x == y;

julia> @test eq(x,y)
Test Failed at REPL[5]:1
  Expression: eq(x, y)

A few options are presented on Discourse but they all require intervention by the tester at the test site.

I want to customize the error display by dispatching on the predicate function and/or its arguments. So for my custom eq and maybe its argument types I could get

julia> @test eq(x,y)
Test Failed at REPL[5]:1
Expression eq(x,y)
  Evaluated eq(1,2)

and other predicates could define other displays.

@nsajko nsajko added the testsystem The unit testing framework and Test stdlib label Sep 29, 2024
@giordano
Copy link
Contributor

Related: #55409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

No branches or pull requests

3 participants