Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for method-wise cache invalidation. #71

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test precompile limitations
  • Loading branch information
willow-ahrens committed Jan 9, 2021
commit 3661204c96503b1a83b9032574e7ae3299273674
11 changes: 8 additions & 3 deletions test/TestPrecompile/src/TestPrecompile.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module TestPrecompile
using Memoize
@memoize forgetful(x) = true
forgetful(true)
end # module
run = 0
@memoize function forgetful(x)
global run += 1
return true
end

forgetful(1)
end # module
7 changes: 7 additions & 0 deletions test/TestPrecompile2/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name = "TestPrecompile2"
uuid = "7fd9c7c1-bae8-496a-aa66-4a9878cd045a"
authors = ["Peter Ahrens <ptrahrens@gmail.com>"]
version = "0.1.0"

[deps]
TestPrecompile = "ff0854c6-fbc5-40f0-bd2d-de277d7b8f28"
6 changes: 6 additions & 0 deletions test/TestPrecompile2/src/TestPrecompile2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module TestPrecompile2

using TestPrecompile
TestPrecompile.forgetful(2)

end # module
11 changes: 10 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -373,7 +373,16 @@ Pkg.activate(temp=true)
Pkg.develop(path=joinpath(@__DIR__, "TestPrecompile"))
using TestPrecompile

@test length(memories(TestPrecompile.forgetful)) >= 1
@test TestPrecompile.run == 1
@test TestPrecompile.forgetful(1)
@test TestPrecompile.run == 1

Pkg.develop(path=joinpath(@__DIR__, "TestPrecompile2"))
using TestPrecompile2

@test TestPrecompile.run == 1
@test TestPrecompile.forgetful(2)
@test TestPrecompile.run == 2

run = 0
@memoize Dict{Tuple{String},Int}() function dict_call(a::String)::Int