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

@ -34,92 +34,92 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "a") [] a)
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "a") [] a)
)
(call %init_peer_id% ("getDataSrv" "b") [] b)
)
(call %init_peer_id% ("getDataSrv" "b") [] b)
(call %init_peer_id% ("getDataSrv" "c") [] c)
)
(call %init_peer_id% ("getDataSrv" "c") [] c)
(call %init_peer_id% ("getDataSrv" "d") [] d)
)
(call %init_peer_id% ("getDataSrv" "d") [] d)
(call %init_peer_id% ("getDataSrv" "e") [] e)
)
(call %init_peer_id% ("getDataSrv" "e") [] e)
(call %init_peer_id% ("getDataSrv" "g") [] g)
)
(call %init_peer_id% ("getDataSrv" "g") [] g)
(call %init_peer_id% ("getDataSrv" "str") [] str)
)
(call %init_peer_id% ("getDataSrv" "str") [] str)
(call %init_peer_id% ("some-id" "t") [str] $stream)
)
(call %init_peer_id% ("some-id" "t") [str] $stream)
)
(par
(call %init_peer_id% ("println-service-id" "print") [a])
(seq
(par
(call %init_peer_id% ("println-service-id" "print") [a])
(seq
(seq
(call -relay- ("op" "identity") [])
(xor
(call a ("peer" "identify") [])
(seq
(call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
(seq
(call -relay- ("op" "identity") [])
(xor
(call a ("peer" "identify") [])
(seq
(call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
)
(call -relay- ("op" "identity") [])
)
(call -relay- ("op" "identity") [])
(call %init_peer_id% ("op" "identity") [])
)
(call %init_peer_id% ("op" "identity") [])
)
)
(call -relay- ("op" "identity") [])
)
(call -relay- ("op" "identity") [])
)
(xor
(xor
(match c true
(xor
(match d true
(xor
(fold e eEl
(xor
(match c true
(xor
(match d true
(xor
(fold e eEl
(seq
(seq
(fold g gEl
(seq
(seq
(call b ("some-id" "t") [gEl] $stream)
(call b ("some-id" "t") [eEl] $stream)
)
(next gEl)
)
)
(call b ("some-id" "t") [eEl] $stream)
)
(next eEl)
)
)
(seq
(seq
(fold g gEl
(seq
(seq
(call b ("some-id" "t") [gEl] $stream)
(call b ("some-id" "t") [eEl] $stream)
)
(next gEl)
)
)
(call b ("some-id" "t") [eEl] $stream)
(call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
(next eEl)
)
)
(seq
(seq
(call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
(call -relay- ("op" "identity") [])
)
)
(null)
)
(null)
)
(null)
)
(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 -relay- ("op" "identity") [])
(call %init_peer_id% ("some-id" "multiline") [a b c] $stream)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [$stream])

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)