This commit is contained in:
DieMyst
2021-10-26 19:29:44 +03:00
parent efb24218d9
commit 17f68fe491
4 changed files with 18 additions and 21 deletions

View File

@@ -1,23 +1,13 @@
func toOpt(s: string) -> ?string:
str: ?string
str: *string
str <<- s
<- str
-- func accumRes() -> *string:
-- res_accum: *string
-- a <- toOpt("a")
-- res_accum <<- a
-- res_accum <- toOpt("b")
-- res_accum <<- nil
-- <- res_accum
func accumRes(a: string, b: string) -> []?string:
func accumRes() -> *?string:
res_accum: *?string
str: ?string
str <<- a
str2: ?string
str2 <<- b
res_accum <<- str
res_accum <<- str2
-- todo: add when 277 fixed
-- a <- toOpt("a")
-- res_accum <<- a
res_accum <- toOpt("b")
res_accum <<- nil
<- res_accum
<- res_accum

View File

@@ -136,7 +136,8 @@ describe('Testing examples', () => {
it('streamCan.aqua', async () => {
let streamCanResult = await streamCanCall();
expect(streamCanResult).toBe([["a"], ["b"], []]);
expect(streamCanResult).toBe([["b"], []]);
// expect(streamCanResult).toBe([["a"], ["b"], []]);
});
it('topology.aqua', async () => {

View File

@@ -142,9 +142,15 @@ export function returnNil(...args: any) {
let script = `
(xor
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("op" "identity") [$valueNil] valueNil-0)
)
(ap valueNil-0 $relayNil)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [$valueNil])
(call %init_peer_id% ("callbackSrv" "response") [$relayNil])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)

View File

@@ -1,5 +1,5 @@
import {accumRes} from "../compiled/examples/streamCan";
export async function streamCanCall() {
return await accumRes("a", "b");
return await accumRes();
}