-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d835e0
commit 715d3a4
Showing
14 changed files
with
149 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Genie" | ||
uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e" | ||
authors = ["Adrian Salceanu <[email protected]>"] | ||
version = "0.31.4" | ||
version = "0.31.5" | ||
|
||
[deps] | ||
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@testset "Sessions functionality" begin | ||
|
||
@testset "Assets paths" begin | ||
using Genie, Genie.Sessions | ||
using Genie.Router | ||
using HTTP | ||
|
||
Sessions.init() | ||
|
||
route("/home") do | ||
sess = Sessions.session(Genie.Router.@params) | ||
Sessions.set!(sess, :visit_count, Sessions.get(sess, :visit_count, 0)+1) | ||
|
||
"$(Sessions.get(sess, :visit_count))" | ||
end | ||
|
||
Genie.up() | ||
|
||
# TODO: extend to use the cookie and increment the count | ||
response = HTTP.get("http://$(Genie.config.server_host):$(Genie.config.server_port)/home") | ||
@test response.body |> String == "1" | ||
|
||
Genie.down() | ||
end; | ||
|
||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,61 @@ | ||
@testset "Caching" begin | ||
# @testset "Empty string" begin | ||
# using Genie, Genie.Cache | ||
using Genie, Genie.Cache | ||
|
||
# @test String(r.body) == "<html><head></head><body></body></html>" | ||
# end; | ||
function f() | ||
rand(1:1_000) | ||
end | ||
|
||
Genie.config.cache_duration = 0 # no caching | ||
|
||
r0 = f() | ||
|
||
r1 = withcache(:x) do | ||
f() | ||
end | ||
|
||
@test r0 != r1 # because cache_duration == 0 so no caching | ||
|
||
r2 = withcache(:x) do | ||
f() | ||
end | ||
|
||
@test r1 != r2 # because cache_duration == 0 so no caching | ||
|
||
Genie.config.cache_duration = 5 # cache for 5s | ||
|
||
r1 = withcache(:x) do | ||
f() | ||
end | ||
|
||
r2 = withcache(:x) do | ||
f() | ||
end | ||
|
||
@test r1 == r2 | ||
|
||
r3 = withcache(:x, condition = false) do # disable caching cause ! condition | ||
f() | ||
end | ||
|
||
@test r1 == r2 != r3 | ||
|
||
r4 = withcache(:x, 0) do # disable caching with 0 duration | ||
f() | ||
end | ||
|
||
@test r1 == r2 != r3 != r4 | ||
|
||
r5 = withcache(:x) do # regular cache should still work as under 5s passed | ||
f() | ||
end | ||
|
||
@test r1 == r2 == r5 | ||
|
||
sleep(6) | ||
|
||
r6 = withcache(:x) do # regular cache should not work as over 5s passed | ||
f() | ||
end | ||
|
||
@test r1 == r2 == r5 != r6 | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
numbers: [1, 1, 2, 3, 5, 8, 13] | ||
--- | ||
|
||
# There are $(length(numbers)) | ||
|
||
$( | ||
@foreach(numbers) do number | ||
" -> $number | ||
" | ||
end | ||
) |
715d3a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
715d3a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/17296
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: