Skip to content

Test: @test_warn failure messages are unhelpful #57360

Open
@IanButterworth

Description

@IanButterworth
julia> using Test

julia> @test_warn r"foo" time()
Test Failed at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/Test/src/Test.jl:869
  Expression: contains_warn(read(fname, String), $(Expr(:escape, :(r"foo"))))

ERROR: There was an error during testing

(on 1.10 but it's the same on master)

  1. It should show what read(fname, String) returned
  2. $(Expr(:escape, :(r"foo"))) is messy
  3. The order of the args to contains_warn is the reverse of the macro input, which is confusing
  4. The location of the test is within the Test stdlib, not the user test file.
  5. The buildpath /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/Test/src/Test.jl:869 should be fixed-up

Metadata

Metadata

Assignees

No one assigned

    Labels

    testThis change adds or pertains to unit tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions