diff --git a/.gitignore b/.gitignore index 094550a54..bbe86fa81 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ docs/build .vscode test/build Manifest.toml +test/cache +test/sessions \ No newline at end of file diff --git a/test/tests_cache.jl b/test/tests_cache.jl index 26a82fb0a..0d4040b15 100644 --- a/test/tests_cache.jl +++ b/test/tests_cache.jl @@ -1,4 +1,4 @@ -@testset "Caching" begin +@safetestset "No Caching" begin using Genie, Genie.Cache function f() @@ -9,7 +9,7 @@ r0 = f() - r1 = withcache(:x) do + r1 = withcache(:x) do f() end @@ -20,9 +20,18 @@ end @test r1 != r2 # because cache_duration == 0 so no caching +end + - Genie.config.cache_duration = 5 # cache for 5s +@safetestset "cache" begin + using Genie, Genie.Cache + function f() + rand(1:1_000) + end + + Genie.config.cache_duration = 5 + r1 = withcache(:x) do f() end @@ -58,4 +67,4 @@ end @test r1 == r2 == r5 != r6 -end; \ No newline at end of file +end \ No newline at end of file