Updated tests to check return type processing

This commit is contained in:
coffeepots 2018-05-08 17:30:05 +01:00 committed by zah
parent 31c9ca9196
commit 444bbc1493

View File

@ -57,6 +57,13 @@ s.on("rpc.seqparam") do(a: string, s: seq[int]):
s.on("rpc.objparam") do(a: string, obj: MyObject):
result = %obj
s.on("rpc.returntypesimple") do(i: int) -> int:
result = i
s.on("rpc.returntypecomplex") do(i: int) -> Test2:
result.x = [1, i, 3]
result.y = "test"
# Tests
suite "Server types":
@ -81,6 +88,18 @@ suite "Server types":
let r = waitfor rpcObjParam(%[%"abc", testObj])
check r == testObj
test "Simple return types":
let
inp = %99
r1 = waitfor rpcReturnTypeSimple(%[%inp])
check r1 == inp
test "Complex return types":
let
inp = 99
r1 = waitfor rpcReturnTypeComplex(%[%inp])
check r1 == %*{"x": %[1, inp, 3], "y": "test"}
test "Runtime errors":
expect ValueError:
discard waitfor rpcArrayParam(%[%[0, 1, 2, 3, 4, 5, 6], %"hello"])