diff options
Diffstat (limited to 'tests/async/tasynctry.nim')
-rw-r--r-- | tests/async/tasynctry.nim | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/tests/async/tasynctry.nim b/tests/async/tasynctry.nim index 6749aabbf..25eab87fb 100644 --- a/tests/async/tasynctry.nim +++ b/tests/async/tasynctry.nim @@ -1,13 +1,13 @@ discard """ - file: "tasynctry.nim" - exitcode: 0 - output: ''' +output: ''' Generic except: Test Specific except Multiple idents in except Multiple except branches Multiple except branches 2 +success ''' +targets: "c" """ import asyncdispatch, strutils @@ -15,7 +15,7 @@ import asyncdispatch, strutils proc foobar() {.async.} = if 5 == 5: - raise newException(EInvalidIndex, "Test") + raise newException(IndexDefect, "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 IndexDefect: echo("Specific except") try: await foobar() - except OSError, EInvalidField, EInvalidIndex: + except OSError, FieldDefect, IndexDefect: echo("Multiple idents in except") try: await foobar() - except OSError, EInvalidField: + except OSError, FieldDefect: assert false - except EInvalidIndex: + except IndexDefect: echo("Multiple except branches") try: await foobar() - except EInvalidIndex: + except IndexDefect: echo("Multiple except branches 2") - except OSError, EInvalidField: + except OSError, FieldDefect: assert false waitFor catch() @@ -102,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()) |