From aa16ceac581d5a94e82496cc66c2600f7c31dd80 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Sun, 9 Apr 2023 17:07:54 +0200 Subject: [PATCH] add a test that extension is available during precompilation --- .../HasDepWithExtensions.jl/src/HasDepWithExtensions.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/project/Extensions/HasDepWithExtensions.jl/src/HasDepWithExtensions.jl b/test/project/Extensions/HasDepWithExtensions.jl/src/HasDepWithExtensions.jl index d64cbc680e3a5..5c1f2d1f301aa 100644 --- a/test/project/Extensions/HasDepWithExtensions.jl/src/HasDepWithExtensions.jl +++ b/test/project/Extensions/HasDepWithExtensions.jl/src/HasDepWithExtensions.jl @@ -4,10 +4,18 @@ using HasExtensions: HasExtensions, HasExtensionsStruct using ExtDep: ExtDepStruct # Loading ExtDep makes the extension "Extension" load +const m = Base.get_extension(HasExtensions, :Extension) +m isa Module || error("extension not loaded during precompilation") + function do_something() HasExtensions.foo(HasExtensionsStruct()) == 1 || error() HasExtensions.foo(ExtDepStruct()) == 2 || error() return true end +function __init__() + m = Base.get_extension(HasExtensions, :Extension) + m isa Module || error("extension not loaded during __init__") +end + end # module