JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.73k stars 5.49k forks source link

Test: Evaluated expression should expand full expression #55409

Open IanButterworth opened 3 months ago

IanButterworth commented 3 months ago
julia> x = "foo";

julia> @test startswith(x, "bar")
Test Failed at REPL[3]:1
  Expression: startswith(x, "bar")
   Evaluated: startswith("foo", "bar")

ERROR: There was an error during testing

Looks great, however the following doesn't show the evaluated values

julia> @test startswith(x, "bar") || startswith(x, "baz")
Test Failed at REPL[4]:1
  Expression: startswith(x, "bar") || startswith(x, "baz")

ERROR: There was an error during testing

Seems like the handling needs to be recursive.

bvdmitri commented 3 months ago

I would pretty much like it too, its quite annoying that the default printing doesn't show a lot of useful information for expressions that are a bit more than basic. For example

julia> @test 0 ≈ 1
Test Failed at REPL[4]:1
  Expression: 0 ≈ 1
   Evaluated: 0 ≈ 1

julia> a = zeros(100);

julia> b = ones(100);

julia> @test all(a .≈ b)
Test Failed at REPL[11]:1
  Expression: all(a .≈ b)