make tests green again
This commit is contained in:
parent
9b31f67859
commit
0926754e68
31 changed files with 61 additions and 55 deletions
|
|
@ -20,7 +20,7 @@ proc processClient(fd: int) {.async.} =
|
|||
var line = await recvLine(fd)
|
||||
var foo = line[0]
|
||||
if foo == 'g':
|
||||
raise newException(EBase, "foobar")
|
||||
raise newException(Exception, "foobar")
|
||||
|
||||
proc serve() {.async.} =
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import asyncdispatch, strutils
|
|||
|
||||
proc foobar() {.async.} =
|
||||
if 5 == 5:
|
||||
raise newException(EInvalidIndex, "Test")
|
||||
raise newException(IndexError, "Test")
|
||||
|
||||
proc catch() {.async.} =
|
||||
# TODO: Create a test for when exceptions are not caught.
|
||||
|
|
@ -26,26 +26,26 @@ proc catch() {.async.} =
|
|||
|
||||
try:
|
||||
await foobar()
|
||||
except EInvalidIndex:
|
||||
except IndexError:
|
||||
echo("Specific except")
|
||||
|
||||
try:
|
||||
await foobar()
|
||||
except OSError, EInvalidField, EInvalidIndex:
|
||||
except OSError, FieldError, IndexError:
|
||||
echo("Multiple idents in except")
|
||||
|
||||
try:
|
||||
await foobar()
|
||||
except OSError, EInvalidField:
|
||||
except OSError, FieldError:
|
||||
assert false
|
||||
except EInvalidIndex:
|
||||
except IndexError:
|
||||
echo("Multiple except branches")
|
||||
|
||||
try:
|
||||
await foobar()
|
||||
except EInvalidIndex:
|
||||
except IndexError:
|
||||
echo("Multiple except branches 2")
|
||||
except OSError, EInvalidField:
|
||||
except OSError, FieldError:
|
||||
assert false
|
||||
|
||||
waitFor catch()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ when defined(windows):
|
|||
var clientCount = 0
|
||||
|
||||
proc winConnect*(socket: AsyncFD, address: string, port: Port,
|
||||
domain = Domain.AF_INET): Future[void] =
|
||||
domain = Domain.AF_INET): Future[void] =
|
||||
var retFuture = newFuture[void]("winConnect")
|
||||
proc cb(fd: AsyncFD): bool =
|
||||
var ret = SocketHandle(fd).getSockOptInt(cint(SOL_SOCKET), cint(SO_ERROR))
|
||||
|
|
@ -183,7 +183,7 @@ when defined(windows):
|
|||
## **Note**: This procedure is mostly used for testing. You likely want to
|
||||
## use ``asyncnet.recvLine`` instead.
|
||||
|
||||
template addNLIfEmpty(): stmt =
|
||||
template addNLIfEmpty() =
|
||||
if result.len == 0:
|
||||
result.add("\c\L")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue