diff --git a/ethers/testing.nim b/ethers/testing.nim index ea2cfcb..f082ea2 100644 --- a/ethers/testing.nim +++ b/ethers/testing.nim @@ -23,7 +23,7 @@ proc reverts*[T](call: Future[T]): Future[bool] {.async.} = when T is void: await call else: - discard await call # TODO test this + discard await call return false except ProviderError: return true @@ -33,7 +33,7 @@ proc reverts*[T](call: Future[T], reason: string): Future[bool] {.async.} = when T is void: await call else: - discard await call # TODO test this + discard await call return false except ProviderError as error: return reason == error.revertReason diff --git a/testmodule/testTesting.nim b/testmodule/testTesting.nim index e88dda9..8c2f35f 100644 --- a/testmodule/testTesting.nim +++ b/testmodule/testTesting.nim @@ -60,6 +60,11 @@ suite "Testing helpers": check await call().reverts(nonStdMsg) + test "works with functions that return a value": + proc call(): Future[int] {.async.} = return 42 + check not await call().reverts() + check not await call().reverts("some reason") + type TestHelpers* = ref object of Contract