mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-30 02:21:43 +00:00
Merge branch 'devel' into sighashes
This commit is contained in:
28
tests/stdlib/thttpcore.nim
Normal file
28
tests/stdlib/thttpcore.nim
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
import unittest
|
||||
|
||||
import httpcore
|
||||
|
||||
suite "httpcore":
|
||||
|
||||
test "HttpCode":
|
||||
assert $Http418 == "418 I'm a teapot"
|
||||
assert Http418.is4xx() == true
|
||||
assert Http418.is2xx() == false
|
||||
|
||||
test "headers":
|
||||
var h = newHttpHeaders()
|
||||
assert h.len == 0
|
||||
h.add("Cookie", "foo")
|
||||
assert h.len == 1
|
||||
assert h.hasKey("cooKIE")
|
||||
assert h["Cookie"] == "foo"
|
||||
assert 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"]
|
||||
h.del("coOKie")
|
||||
assert h.len == 0
|
||||
@@ -1,6 +1,11 @@
|
||||
discard """
|
||||
file: "txmltree.nim"
|
||||
output: "true"
|
||||
output: '''true
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
'''
|
||||
"""
|
||||
|
||||
import xmltree, strtabs
|
||||
@@ -9,5 +14,14 @@ var x = <>a(href="nim.de", newText("www.nim-test.de"))
|
||||
|
||||
echo($x == "<a href=\"nim.de\">www.nim-test.de</a>")
|
||||
|
||||
echo(newText("foo").innerText == "foo")
|
||||
echo(newEntity("bar").innerText == "bar")
|
||||
echo(newComment("baz").innerText == "")
|
||||
|
||||
|
||||
let y = newXmlTree("x", [
|
||||
newText("foo"),
|
||||
newXmlTree("y", [
|
||||
newText("bar")
|
||||
])
|
||||
])
|
||||
echo(y.innerText == "foobar")
|
||||
|
||||
Reference in New Issue
Block a user