diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ccgbugs/tmissingderef2.nim | 25 | ||||
-rw-r--r-- | tests/ccgbugs/tobjconstr_regression.nim | 14 | ||||
-rw-r--r-- | tests/cpp/tasync_cpp.nim | 3 | ||||
-rw-r--r-- | tests/stdlib/thttpcore.nim | 28 | ||||
-rw-r--r-- | tests/stdlib/txmltree.nim | 18 |
5 files changed, 86 insertions, 2 deletions
diff --git a/tests/ccgbugs/tmissingderef2.nim b/tests/ccgbugs/tmissingderef2.nim new file mode 100644 index 000000000..59cd24dd1 --- /dev/null +++ b/tests/ccgbugs/tmissingderef2.nim @@ -0,0 +1,25 @@ +discard """ + output: "c" +""" + +# bug #5079 + +import tables, strutils + +type Test = ref object + s: string + +proc `test=`(t: Test, s: string) = + t.s = s + +var t = Test() + +#t.test = spaces(2) # -- works + +var a = newTable[string, string]() +a["b"] = "c" + +#t.s = a["b"] # -- works +#t.test a["b"] # -- works +t.test = a["b"] # -- prints "out of memory" and quits +echo t.s diff --git a/tests/ccgbugs/tobjconstr_regression.nim b/tests/ccgbugs/tobjconstr_regression.nim new file mode 100644 index 000000000..87d037894 --- /dev/null +++ b/tests/ccgbugs/tobjconstr_regression.nim @@ -0,0 +1,14 @@ +discard """ + output: "@[(username: user, role: admin, description: desc, email_addr: email), (username: user, role: admin, description: desc, email_addr: email)]" +""" + +type + User = object of RootObj + username, role, description, email_addr: string + +# bug 5055 +let us4 = @[ + User(username:"user", role:"admin", description:"desc", email_addr:"email"), + User(username:"user", role:"admin", description:"desc", email_addr:"email"), +] +echo us4 diff --git a/tests/cpp/tasync_cpp.nim b/tests/cpp/tasync_cpp.nim index 792f2938b..ec78ae26c 100644 --- a/tests/cpp/tasync_cpp.nim +++ b/tests/cpp/tasync_cpp.nim @@ -8,4 +8,7 @@ discard """ import jester import asyncdispatch, asyncnet +# bug #5081 +#import nre + echo "hello" diff --git a/tests/stdlib/thttpcore.nim b/tests/stdlib/thttpcore.nim new file mode 100644 index 000000000..9f99df93a --- /dev/null +++ b/tests/stdlib/thttpcore.nim @@ -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 diff --git a/tests/stdlib/txmltree.nim b/tests/stdlib/txmltree.nim index bfe2dc94a..a849859e3 100644 --- a/tests/stdlib/txmltree.nim +++ b/tests/stdlib/txmltree.nim @@ -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") |