Skip to content

Commit

Permalink
fix escaping in testset with options
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Sep 18, 2020
1 parent 324194c commit 9ef331f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/Test/src/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ function parse_testset_args(args)
elseif isa(arg, Expr) && arg.head === :(=)
# we're building up a Dict literal here
key = Expr(:quote, arg.args[1])
push!(options.args, Expr(:call, :(=>), key, arg.args[2]))
push!(options.args, Expr(:call, :(=>), key, esc(arg.args[2])))
else
error("Unexpected argument $arg to @testset")
end
Expand Down
7 changes: 7 additions & 0 deletions stdlib/Test/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,13 @@ for i in 1:6
@test typeof(tss[i].results[4].results[1]) == (iseven(i) ? Pass : Fail)
end

# test that second argument is escaped correctly
foo = 3
tss = @testset CustomTestSet foo=foo "custom testset - escaping" begin
@test true
end
@test tss.foo = 3

# test @inferred
uninferrable_function(i) = (1, "1")[i]
uninferrable_small_union(i) = (1, nothing)[i]
Expand Down

0 comments on commit 9ef331f

Please sign in to comment.