summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYuriy Glukhov <yuriy.glukhov@gmail.com>2018-06-06 20:04:37 +0300
committerYuriy Glukhov <yuriy.glukhov@gmail.com>2018-06-06 20:04:37 +0300
commit511d7079a1d5890c4add4b00f79606934e3e3414 (patch)
tree9ed7164408d08dcdb90d711ef6d717c3dcc317dd
parent6ee6f252d487ff22cdaa20eecf9a3975082863e9 (diff)
downloadNim-511d7079a1d5890c4add4b00f79606934e3e3414.tar.gz
Fixed tests
-rw-r--r--tests/async/tasync_traceback.nim26
-rw-r--r--tests/async/tasynctry.nim4
-rw-r--r--tests/async/tasynctry2.nim2
3 files changed, 24 insertions, 8 deletions
diff --git a/tests/async/tasync_traceback.nim b/tests/async/tasync_traceback.nim
index 618a1dc76..b6c6a916b 100644
--- a/tests/async/tasync_traceback.nim
+++ b/tests/async/tasync_traceback.nim
@@ -3,7 +3,7 @@ discard """
   disabled: "windows"
   output: "Matched"
 """
-import asyncdispatch
+import asyncdispatch, strutils
 
 # Tests to ensure our exception trace backs are friendly.
 
@@ -117,10 +117,26 @@ Exception message: bar failure
 Exception type:
 """
 
-if result.match(re(expected)):
-  echo("Matched")
-else:
-  echo("Not matched!")
+let resLines = splitLines(result.strip)
+let expLines = splitLines(expected.strip)
+
+if resLines.len != expLines.len:
+  echo("Not matched! Wrong number of lines!")
   echo()
   echo(result)
   quit(QuitFailure)
+
+var ok = true
+for i in 0 ..< resLines.len:
+  if not resLines[i].match(re(expLines[i])):
+    echo "Not matched! Line ", i + 1
+    echo "Expected:"
+    echo expLines[i]
+    echo "Actual:"
+    echo resLines[i]
+    ok = false
+
+if ok:
+  echo("Matched")
+else:
+  quit(QuitFailure)
diff --git a/tests/async/tasynctry.nim b/tests/async/tasynctry.nim
index 5930f296f..6749aabbf 100644
--- a/tests/async/tasynctry.nim
+++ b/tests/async/tasynctry.nim
@@ -9,7 +9,7 @@ Multiple except branches
 Multiple except branches 2
 '''
 """
-import asyncdispatch
+import asyncdispatch, strutils
 
 # Here we are testing the ability to catch exceptions.
 
@@ -22,7 +22,7 @@ proc catch() {.async.} =
   try:
     await foobar()
   except:
-    echo("Generic except: ", getCurrentExceptionMsg())
+    echo("Generic except: ", getCurrentExceptionMsg().splitLines[0])
 
   try:
     await foobar()
diff --git a/tests/async/tasynctry2.nim b/tests/async/tasynctry2.nim
index f82b6cfe0..4b3f17cc5 100644
--- a/tests/async/tasynctry2.nim
+++ b/tests/async/tasynctry2.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tasynctry2.nim"
   errormsg: "\'yield\' cannot be used within \'try\' in a non-inlined iterator"
-  line: 17
+  line: 14
 """
 import asyncdispatch