julia-vscode / TestItemRunner.jl

Run Julia test items
MIT License
67 stars 11 forks source link

Default using or import #10

Closed davidanthoff closed 1 year ago

davidanthoff commented 1 year ago

We could by default add using Test, MYPACKAGE to any @testitem before it is executed and provide a flag to turn that off.

Right now a typical @testitem looks like this:

@testitem "Foo" begin
    using Test, MyPackage

    x = bar()
    @test x == "something"
end

With this new default it could be written as

@testitem "Foo" begin
    x = bar()
    @test x == "something"
end

If one did not want the default package imports, one would write

@testitem "Foo" default_imports=false begin
    x = bar()
    @test x == "something"
end

or something like that.

davidanthoff commented 1 year ago

The first part of this, namely the auto using statements is now implemented in both the VS Code extension and here once https://github.com/julia-vscode/TestItemRunner.jl/pull/16 is merged. Still need to add support for the flag.