Skip to content

Test: Context not given when @testset let errors #57779

Open
@IanButterworth

Description

@IanButterworth

This has context.

julia> @testset let x = 1
       @test x == 2
       end
Test Failed at REPL[7]:2
  Expression: x == 2
   Evaluated: 1 == 2
     Context: x = 1

ERROR: There was an error during testing

This doesn't, and I think it should

julia> @testset let x = 1
       @test error()
       end
Error During Test at REPL[8]:2
  Test threw exception
  Expression: error()

  Stacktrace:
   [1] error()
     @ Base ./error.jl:45
   [2] top-level scope
     @ REPL[8]:0
   [3] macro expansion
     @ ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.13/Test/src/Test.jl:1703 [inlined]
   [4] macro expansion
     @ REPL[8]:2 [inlined]
   [5] macro expansion
     @ ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.13/Test/src/Test.jl:676 [inlined]
   [6] macro expansion
     @ REPL[8]:2 [inlined]
ERROR: There was an error during testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsystemThe unit testing framework and Test stdlib

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions