I just encountered the problem discussed in Best solution to Julia's soft scope problem? , but in the context of unit tests. Specifically, in code like this:
@testitem "foo" begin
A = 0
for i in 1:10
A += i
end
@test A == 55
end
This succeeds when running tests via pkg> test
, but fails when running in VS Code’s test pane. Presumably because they differ about whether they create a new scope for each test?
Should this be considered a bug in whatever the test pane is using behind the scenes (part of the Julia Extension, I think?)? Or do test writers need to worry about scope problems like this, and sprinkle let
and/or global
declarations around? [I would advocate for not the latter.]
I have v1.120.2 of the Julia Extension installed.