use doAssert in tests (#16486)
This commit is contained in:
parent
f9a15dbae9
commit
6d442a40a6
78 changed files with 1056 additions and 1056 deletions
|
|
@ -2,31 +2,31 @@ import httpcore, strutils
|
|||
|
||||
block:
|
||||
block HttpCode:
|
||||
assert $Http418 == "418 I'm a teapot"
|
||||
assert Http418.is4xx() == true
|
||||
assert Http418.is2xx() == false
|
||||
doAssert $Http418 == "418 I'm a teapot"
|
||||
doAssert Http418.is4xx() == true
|
||||
doAssert Http418.is2xx() == false
|
||||
|
||||
block headers:
|
||||
var h = newHttpHeaders()
|
||||
assert h.len == 0
|
||||
doAssert h.len == 0
|
||||
h.add("Cookie", "foo")
|
||||
assert h.len == 1
|
||||
assert h.hasKey("cooKIE")
|
||||
assert h["Cookie"] == "foo"
|
||||
assert h["cookie"] == "foo"
|
||||
doAssert h.len == 1
|
||||
doAssert h.hasKey("cooKIE")
|
||||
doAssert h["Cookie"] == "foo"
|
||||
doAssert h["cookie"] == "foo"
|
||||
h["cookie"] = @["bar", "x"]
|
||||
assert h["Cookie"] == "bar"
|
||||
assert h["Cookie", 1] == "x"
|
||||
assert h["Cookie"].contains("BaR") == true
|
||||
assert h["Cookie"].contains("X") == true
|
||||
assert "baR" in h["cookiE"]
|
||||
doAssert h["Cookie"] == "bar"
|
||||
doAssert h["Cookie", 1] == "x"
|
||||
doAssert h["Cookie"].contains("BaR") == true
|
||||
doAssert h["Cookie"].contains("X") == true
|
||||
doAssert "baR" in h["cookiE"]
|
||||
h.del("coOKie")
|
||||
assert h.len == 0
|
||||
doAssert h.len == 0
|
||||
|
||||
# Test that header constructor works with repeated values
|
||||
let h1 = newHttpHeaders({"a": "1", "a": "2", "A": "3"})
|
||||
|
||||
assert seq[string](h1["a"]).join(",") == "1,2,3"
|
||||
doAssert seq[string](h1["a"]).join(",") == "1,2,3"
|
||||
|
||||
block test_cookies_with_comma:
|
||||
doAssert parseHeader("cookie: foo, bar") == ("cookie", @["foo, bar"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue