From e27dd4aaa4336db35424044bb2675c0e12d5028a Mon Sep 17 00:00:00 2001 From: codingonsteroid Date: Sat, 19 Sep 2020 16:23:37 +0530 Subject: [PATCH] modified test_cache to use safetestset --- .gitignore | 2 ++ test/Project.toml | 1 + test/tests_cache.jl | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) 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/Project.toml b/test/Project.toml index 955b73c15..a5c002482 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,5 +1,6 @@ [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e" HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" 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