tests: add more tests

This commit is contained in:
nixo 2020-10-25 10:45:26 +01:00
parent 34a9a1a017
commit 0e93698305
1 changed files with 16 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using Test
unescape_expected = [
"String without percent" => "String without percent",
"String%20with%20spaces" => "String with spaces",
@ -58,3 +59,18 @@ end
("gemini", "hostname", 1965, ["a", "b", "c"], "percent encoding"))
end
end
@testset "Request to string" begin
@test string(Request("gemini://host")) == "host"
@test string(Request("https://host")) == "https://host"
@test string(Request("host:1965")) == "host"
@test string(Request("host:1965/")) == "host"
@test string(Request("gemini://host:1965/")) == "host"
@test string(Request("host/a/b")) == "host/a/b"
@test string(Request("https://host/a/b")) == "https://host/a/b"
@test string(Request("https://host:1965/a/b?test")) == "https://host/a/b?test"
end
@testset "Requests format enforced" begin
@test_throws OverflowError Gemenon.get(Request("a" ^ 1025))
end