Skip to content

Commit

Permalink
add a test that extension is available during precompilation
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Apr 9, 2023
1 parent 65c5f28 commit a854387
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a854387

Please sign in to comment.