Additional tests for contract macro

This commit is contained in:
Mark Spanbroek 2022-01-26 10:38:17 +01:00
parent fec6bdc581
commit e833c08303
1 changed files with 10 additions and 0 deletions

View File

@ -52,6 +52,16 @@ suite "Contracts":
await mint(token, accounts[1], 100.u256)
check (await balanceOf(token, accounts[1])) == 0.u256
test "fails to compile when function has an implementation":
let works = compiles:
proc foo(token: TestToken, bar: Address) {.contract.} = discard
check not works
test "fails to compile when function has no parameters":
let works = compiles:
proc foo() {.contract.}
check not works
test "fails to compile when non-constant function has a return type":
let works = compiles:
proc foo(token: TestToken, bar: Address): UInt256 {.contract.}