summary refs log tree commit diff stats
path: root/tests/niminaction/Chapter3
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2018-11-20 11:08:18 +0100
committerAraq <rumpf_a@web.de>2018-11-23 11:58:30 +0100
commit694611627265e4ecb8b0e7623f7d9f82812695e3 (patch)
tree95d9277f7dc414af91d940c53c2f69ab3737cd1b /tests/niminaction/Chapter3
parent161e14829a24ba91c941b5d93cfe1c62867482b0 (diff)
downloadNim-694611627265e4ecb8b0e7623f7d9f82812695e3.tar.gz
fix for nimInAction
Diffstat (limited to 'tests/niminaction/Chapter3')
-rw-r--r--tests/niminaction/Chapter3/ChatApp/src/client.nim4
-rw-r--r--tests/niminaction/Chapter3/ChatApp/src/server.nim6
-rw-r--r--tests/niminaction/Chapter3/various3.nim29
3 files changed, 26 insertions, 13 deletions
diff --git a/tests/niminaction/Chapter3/ChatApp/src/client.nim b/tests/niminaction/Chapter3/ChatApp/src/client.nim
index 4d139655c..d479ebf43 100644
--- a/tests/niminaction/Chapter3/ChatApp/src/client.nim
+++ b/tests/niminaction/Chapter3/ChatApp/src/client.nim
@@ -1,3 +1,7 @@
+discard """
+action: compile
+"""
+
 import os, threadpool, asyncdispatch, asyncnet
 import protocol
 
diff --git a/tests/niminaction/Chapter3/ChatApp/src/server.nim b/tests/niminaction/Chapter3/ChatApp/src/server.nim
index 8c572aeb0..31da74d16 100644
--- a/tests/niminaction/Chapter3/ChatApp/src/server.nim
+++ b/tests/niminaction/Chapter3/ChatApp/src/server.nim
@@ -1,3 +1,7 @@
+discard """
+action: compile
+"""
+
 import asyncdispatch, asyncnet
 
 type
@@ -81,4 +85,4 @@ when isMainModule:
   echo("Server initialised!")
   # Execute the ``loop`` procedure. The ``waitFor`` procedure will run the
   # asyncdispatch event loop until the ``loop`` procedure finishes executing.
-  waitFor loop(server)
\ No newline at end of file
+  waitFor loop(server)
diff --git a/tests/niminaction/Chapter3/various3.nim b/tests/niminaction/Chapter3/various3.nim
index 478229b00..7b2776d70 100644
--- a/tests/niminaction/Chapter3/various3.nim
+++ b/tests/niminaction/Chapter3/various3.nim
@@ -1,3 +1,9 @@
+discard """
+output: '''
+Future is no longer empty, 42
+'''
+"""
+
 import threadpool
 proc foo: string = "Dog"
 var x: FlowVar[string] = spawn foo()
@@ -33,9 +39,9 @@ let data = """
   {"username": "Dominik"}
 """
 
-let obj = parseJson(data) 
-assert obj.kind == JObject 
-assert obj["username"].kind == JString 
+let obj = parseJson(data)
+assert obj.kind == JObject
+assert obj["username"].kind == JString
 assert obj["username"].str == "Dominik"
 
 block:
@@ -60,12 +66,12 @@ var amy = Human(name: "Amy", age: 20)
 
 import asyncdispatch
 
-var future = newFuture[int]() 
-doAssert(not future.finished) 
+var future = newFuture[int]()
+doAssert(not future.finished)
 
-future.callback = 
-  proc (future: Future[int]) = 
-    echo("Future is no longer empty, ", future.read) 
+future.callback =
+  proc (future: Future[int]) =
+    echo("Future is no longer empty, ", future.read)
 
 future.complete(42)
 
@@ -85,9 +91,8 @@ import asyncdispatch, asyncfile, os
 proc readFiles() {.async.} =
   # --- Changed to getTempDir here.
   var file = openAsync(getTempDir() / "test.txt", fmReadWrite)
-  let data = await file.readAll() 
-  echo(data) 
-  await file.write("Hello!\n") 
+  let data = await file.readAll()
+  echo(data)
+  await file.write("Hello!\n")
 
 waitFor readFiles()
-