diff options
Diffstat (limited to 'tests/async/tasynctry.nim')
-rw-r--r-- | tests/async/tasynctry.nim | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/tests/async/tasynctry.nim b/tests/async/tasynctry.nim index a7cb5223d..25eab87fb 100644 --- a/tests/async/tasynctry.nim +++ b/tests/async/tasynctry.nim @@ -5,6 +5,7 @@ Specific except Multiple idents in except Multiple except branches Multiple except branches 2 +success ''' targets: "c" """ @@ -14,7 +15,7 @@ import asyncdispatch, strutils proc foobar() {.async.} = if 5 == 5: - raise newException(IndexError, "Test") + raise newException(IndexDefect, "Test") proc catch() {.async.} = # TODO: Create a test for when exceptions are not caught. @@ -25,26 +26,26 @@ proc catch() {.async.} = try: await foobar() - except IndexError: + except IndexDefect: echo("Specific except") try: await foobar() - except OSError, FieldError, IndexError: + except OSError, FieldDefect, IndexDefect: echo("Multiple idents in except") try: await foobar() - except OSError, FieldError: + except OSError, FieldDefect: assert false - except IndexError: + except IndexDefect: echo("Multiple except branches") try: await foobar() - except IndexError: + except IndexDefect: echo("Multiple except branches 2") - except OSError, FieldError: + except OSError, FieldDefect: assert false waitFor catch() @@ -101,3 +102,17 @@ assert y.waitFor() == 2 y = test4() assert y.waitFor() == 2 + +# bug #14279 + +proc expandValue: Future[int] {.async.} = + return 0 + +proc a(b: int): Future[void] {.async.} = + return + +proc b: Future[void] {.async.} = + await a(await expandValue()) + echo "success" + +waitFor(b()) |