Fixed tests

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

View file

@ -3,7 +3,7 @@ discard """
disabled: "windows" disabled: "windows"
output: "Matched" output: "Matched"
""" """
import asyncdispatch import asyncdispatch, strutils
# Tests to ensure our exception trace backs are friendly. # Tests to ensure our exception trace backs are friendly.
@ -117,10 +117,26 @@ Exception message: bar failure
Exception type: Exception type:
""" """
if result.match(re(expected)): let resLines = splitLines(result.strip)
echo("Matched") let expLines = splitLines(expected.strip)
else:
echo("Not matched!") if resLines.len != expLines.len:
echo("Not matched! Wrong number of lines!")
echo() echo()
echo(result) echo(result)
quit(QuitFailure) 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 Multiple except branches 2
''' '''
""" """
import asyncdispatch import asyncdispatch, strutils
# Here we are testing the ability to catch exceptions. # Here we are testing the ability to catch exceptions.
@ -22,7 +22,7 @@ proc catch() {.async.} =
try: try:
await foobar() await foobar()
except: except:
echo("Generic except: ", getCurrentExceptionMsg()) echo("Generic except: ", getCurrentExceptionMsg().splitLines[0])
try: try:
await foobar() await foobar()

View file

@ -1,7 +1,7 @@
discard """ discard """
file: "tasynctry2.nim" file: "tasynctry2.nim"
errormsg: "\'yield\' cannot be used within \'try\' in a non-inlined iterator" errormsg: "\'yield\' cannot be used within \'try\' in a non-inlined iterator"
line: 17 line: 14
""" """
import asyncdispatch import asyncdispatch