test multiline

This commit is contained in:
DieMyst
2021-06-16 11:38:49 +03:00
parent 79a4c7550b
commit 1005a2a48d
5 changed files with 68 additions and 54 deletions

View File

@ -5,9 +5,15 @@ import "func.aqua"
service TestS("some-id"):
t: string -> string
multiline(a: string,
b: string,
c: bool) -> string
-- just a lot of imports and calls
func doStuff(a: string, b: string, c: bool, d: bool, e: []string, g: []string, str: string) -> []string:
func doStuff(a: string,
b: string,
c: bool,
d: bool, e: []string, g: []string, str: string) -> []string:
stream: *string
stream <- TestS.t(str)
par Println.print(a)
@ -22,4 +28,7 @@ func doStuff(a: string, b: string, c: bool, d: bool, e: []string, g: []string, s
stream <- TestS.t(gEl)
stream <- TestS.t(eEl)
stream <- TestS.t(eEl)
stream <- TestS.multiline(a,
b,
c)
<- stream

View File

@ -8,6 +8,7 @@ service OpO("op"):
-- a question mark means that this constant could be rewritten before this definition
const anotherConst ?= "default-str"
const uniqueConst ?= 5
func callConstant() -> []string:
res: *string

View File

@ -32,6 +32,7 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
(seq
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
@ -110,17 +111,16 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
)
(null)
)
(seq
(seq
(call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
)
(call -relay- ("op" "identity") [])
)
)
)
(call -relay- ("op" "identity") [])
)
(call %init_peer_id% ("some-id" "multiline") [a b c] $stream)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [$stream])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])

View File

@ -8,5 +8,9 @@ export async function complexCall(client: FluenceClient) {
return args[0]
})
registerServiceFunction(client, "some-id", "multiline", (args: any[], _) => {
return args[1]
})
return await doStuff(client, client.relayPeerId!, client.selfPeerId, true, true, ["1", "2"], ["3", "4"], "some str")
}

View File

@ -139,7 +139,7 @@ const main = async () => {
checkCall("dataAliasCall", dataAliasResult, "peer id str", cb)
checkCall("complexCall", complexCallResult, ["some str", "3", "1", "4", "1", "1", "3", "2", "4", "2", "2"], cb)
checkCall("complexCall", complexCallResult, ["some str", "3", "1", "4", "1", "1", "3", "2", "4", "2", "2", client.selfPeerId], cb)
checkCall("constantCall", constantCallResult, ['1', 'ab'], cb)