Skip to content

Commit

Permalink
hijack: fix old testset kwarg
Browse files Browse the repository at this point in the history
The `testset` kwarg was renamed to `include`.

In `load`, pass `nothing` (for `include`) instead of `false`
(for `testset`). This was a silent bug.

In `hijack_base`, don't pass `testset` kwarg to `populate_mod!`
(but it's not relevant there). This bug was not silent, but
`hijack_base` is not tested.
  • Loading branch information
rfourquet committed Aug 6, 2021
1 parent d1fea44 commit 697e528
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hijack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function load(testpath::AbstractString;
Base.include(parentmodule, testpath)
else
files = Dict{String,Module}(testpath => parentmodule)
substitute!(x) = substitute_retest!(x, false, false, files; ishijack=false)
substitute!(x) = substitute_retest!(x, false, nothing, files; ishijack=false)
res = Base.include(substitute!, parentmodule, testpath)
revise_track(Revise, files)
res
Expand Down Expand Up @@ -234,7 +234,7 @@ const root_module = Ref{Symbol}()

__init__() = root_module[] = gensym("MODULE")

function populate_mod!(mod::Module, path; lazy, Revise, include)
function populate_mod!(mod::Module, path; lazy, Revise, include::Maybe{Symbol}=nothing)
lazy (true, false, :brutal) ||
throw(ArgumentError("the `lazy` keyword must be `true`, `false` or `:brutal`"))

Expand Down Expand Up @@ -290,7 +290,7 @@ function hijack(packagemod::Module, modname=nothing; parentmodule::Module=Main,
end
end

function substitute_retest!(ex, lazy, include_, files=nothing;
function substitute_retest!(ex, lazy, include_::Maybe{Symbol}, files=nothing;
ishijack::Bool=true)
substitute!(x) = substitute_retest!(x, lazy, include_, files, ishijack=ishijack)

Expand Down Expand Up @@ -495,7 +495,7 @@ function hijack_base(tests, modname=nothing; parentmodule::Module=Main, lazy=fal
@eval mod begin
using Random
end
populate_mod!(mod, ChooseTests.test_path(test), lazy=lazy, Revise=Revise, testset=false)
populate_mod!(mod, ChooseTests.test_path(test), lazy=lazy, Revise=Revise)
end
end

Expand Down

0 comments on commit 697e528

Please sign in to comment.