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"): service TestS("some-id"):
t: string -> string t: string -> string
multiline(a: string,
b: string,
c: bool) -> string
-- just a lot of imports and calls -- 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: *string
stream <- TestS.t(str) stream <- TestS.t(str)
par Println.print(a) 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(gEl)
stream <- TestS.t(eEl) stream <- TestS.t(eEl)
stream <- TestS.t(eEl) stream <- TestS.t(eEl)
stream <- TestS.multiline(a,
b,
c)
<- stream <- stream

View File

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

View File

@ -34,92 +34,92 @@ 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-) (seq
(call %init_peer_id% ("getDataSrv" "a") [] a) (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])
(par
(call %init_peer_id% ("println-service-id" "print") [a])
(seq
(seq (seq
(seq (seq
(call -relay- ("op" "identity") []) (seq
(xor (call -relay- ("op" "identity") [])
(call a ("peer" "identify") []) (xor
(seq (call a ("peer" "identify") [])
(call -relay- ("op" "identity") []) (seq
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (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 (xor
(match c true (xor
(xor (match c true
(match d true (xor
(xor (match d true
(fold e eEl (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
(seq (seq
(fold g gEl (call -relay- ("op" "identity") [])
(seq (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
(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
(call -relay- ("op" "identity") []) (call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
(call -relay- ("op" "identity") [])
) )
) )
(null)
) )
(null)
) )
(null)
) )
(null)
)
(seq
(seq (seq
(call -relay- ("op" "identity") []) (call -relay- ("op" "identity") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3]) (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 (xor
(call %init_peer_id% ("callbackSrv" "response") [$stream]) (call %init_peer_id% ("callbackSrv" "response") [$stream])

View File

@ -8,5 +8,9 @@ export async function complexCall(client: FluenceClient) {
return args[0] 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") 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("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) checkCall("constantCall", constantCallResult, ['1', 'ab'], cb)