Skip to content

testset inside "testset let" fails #57167

Open
@KnutAM

Description

@KnutAM

Couldn't find any documentation that this should not be supported,
nor any related issues or PRs about the following.

@testset let a = 1
    @testset "for" for b in 1:2
        @test true
    end
end

gives

ERROR: MethodError: no method matching Test.ContextTestSet(::String)
The type `Test.ContextTestSet` exists, but no method is defined for this combination of argument types when trying to construct it.

The other way around (for outside let) works.

versioninfo
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 11 × Apple M3 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 1 default, 0 interactive, 1 GC (on 5 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 
Full stack trace
Closest candidates are:
  Test.ContextTestSet(::Any, ::Any, ::Any)
   @ Test ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1040
  Test.ContextTestSet(::Test.AbstractTestSet, ::Union{Expr, Symbol}, ::Any)
   @ Test ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1040
  Test.ContextTestSet(::Union{Expr, Symbol}, ::Any)
   @ Test ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1045

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1788 [inlined]
 [2] macro expansion
   @ ./REPL[55]:2 [inlined]
 [3] top-level scope
   @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1655 [inlined]
 [4] top-level scope
   @ ./REPL[55]:0

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