Fixed tests

This commit is contained in:
Yuriy Glukhov
2018-06-06 20:04:37 +03:00
parent 6ee6f252d4
commit 511d7079a1
3 changed files with 24 additions and 8 deletions

View File

@@ -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)

View File

@@ -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()

View File

@@ -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