add test for return statement within on macro

This commit is contained in:
coffeepots 2018-05-16 23:16:20 +01:00 committed by zah
parent 206abd8ae8
commit b4c31d5ada

View File

@ -29,6 +29,7 @@ let
var s = newRpcServer("localhost")
# RPC definitions
s.on("rpc.simplepath"):
result = %1
@ -57,6 +58,9 @@ s.on("rpc.returntypecomplex") do(i: int) -> Test2:
result.x = [1, i, 3]
result.y = "test"
s.on("rpc.testreturns") do() -> int:
return 1234
# Tests
suite "Server types":
@ -68,6 +72,7 @@ suite "Server types":
check s.procs.hasKey("rpc.objparam")
check s.procs.hasKey("rpc.returntypesimple")
check s.procs.hasKey("rpc.returntypecomplex")
check s.procs.hasKey("rpc.testreturns")
test "Simple paths":
let r = waitFor rpcSimplePath(%[])
@ -107,6 +112,10 @@ suite "Server types":
r1 = waitfor rpcReturnTypeComplex(%[%inp])
check r1 == %*{"x": %[1, inp, 3], "y": "test"}
test "Return statement":
let r = waitFor rpcTestReturns(%[])
check r == %1234
test "Runtime errors":
expect ValueError:
# root param not array