mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
Fixed tests
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user