diff options
Diffstat (limited to 'tests/js/tasync.nim')
-rw-r--r-- | tests/js/tasync.nim | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/js/tasync.nim b/tests/js/tasync.nim index a164827d2..34ef97b8b 100644 --- a/tests/js/tasync.nim +++ b/tests/js/tasync.nim @@ -1,8 +1,8 @@ discard """ disabled: true output: ''' -0 x +e ''' """ @@ -10,16 +10,22 @@ import asyncjs # demonstrate forward definition # for js -proc y(e: int): Future[string] +proc y(e: int): Future[string] {.async.} -proc x(e: int) {.async.} = +proc e: int {.discardable.} = + echo "e" + return 2 + +proc x(e: int): Future[void] {.async.} = var s = await y(e) echo s + e() proc y(e: int): Future[string] {.async.} = - echo 0 - return "x" - + if e > 0: + return await y(0) + else: + return "x" discard x(2) |