summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/thttpclient.nim10
-rw-r--r--tests/stdlib/tunittest.nim15
2 files changed, 19 insertions, 6 deletions
diff --git a/tests/stdlib/thttpclient.nim b/tests/stdlib/thttpclient.nim
index 7b1111f9b..62c1ebee7 100644
--- a/tests/stdlib/thttpclient.nim
+++ b/tests/stdlib/thttpclient.nim
@@ -13,7 +13,9 @@ proc asyncTest() {.async.} =
   var client = newAsyncHttpClient()
   var resp = await client.request("http://example.com/")
   doAssert(resp.code.is2xx)
-  doAssert("<title>Example Domain</title>" in resp.body)
+  var body = await resp.body
+  body = await resp.body # Test caching
+  doAssert("<title>Example Domain</title>" in body)
 
   resp = await client.request("http://example.com/404")
   doAssert(resp.code.is4xx)
@@ -47,7 +49,8 @@ proc asyncTest() {.async.} =
       echo("Downloaded ", progress, " of ", total)
       echo("Current rate: ", speed div 1000, "kb/s")
     client.onProgressChanged = onProgressChanged
-    discard await client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test")
+    await client.downloadFile("http://speedtest-ams2.digitalocean.com/100mb.test",
+                              "100mb.test")
 
   client.close()
 
@@ -94,7 +97,8 @@ proc syncTest() =
       echo("Downloaded ", progress, " of ", total)
       echo("Current rate: ", speed div 1000, "kb/s")
     client.onProgressChanged = onProgressChanged
-    discard client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test")
+    client.downloadFile("http://speedtest-ams2.digitalocean.com/100mb.test",
+                        "100mb.test")
 
   client.close()
 
diff --git a/tests/stdlib/tunittest.nim b/tests/stdlib/tunittest.nim
index e87cd3508..3f8601323 100644
--- a/tests/stdlib/tunittest.nim
+++ b/tests/stdlib/tunittest.nim
@@ -1,5 +1,11 @@
+discard """
+  nimout: "compile start\ncompile end"
+"""
+
 import unittest, sequtils
 
+static:
+  echo "compile start"
 
 proc doThings(spuds: var int): int =
   spuds = 24
@@ -10,9 +16,9 @@ test "#964":
   check spuds == 24
 
 
-from strutils import toUpper
+from strutils import toUpperAscii
 test "#1384":
-  check(@["hello", "world"].map(toUpper) == @["HELLO", "WORLD"])
+  check(@["hello", "world"].map(toUpperAscii) == @["HELLO", "WORLD"])
 
 
 import options
@@ -57,7 +63,7 @@ suite "suite with only teardown":
 
 suite "suite with only setup":
   setup:
-    var testVar = "from setup"
+    var testVar {.used.} = "from setup"
 
   test "unittest with only setup 1":
     check testVar == "from setup"
@@ -89,3 +95,6 @@ suite "bug #4494":
       var tags = @[1, 2, 3, 4, 5]
       check:
         allIt(0..3, tags[it] != tags[it + 1])
+
+static:
+  echo "compile end"