mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-03-15 01:51:03 +00:00
Check nil literal as result and with length
functor (#52)
This commit is contained in:
parent
d47e2c3645
commit
b83b43e86b
@ -28,6 +28,13 @@ func returnNil() -> *string:
|
||||
relayNil <- stringNil()
|
||||
<- relayNil
|
||||
|
||||
func returnNilLiteral() -> *string:
|
||||
<- nil
|
||||
|
||||
func returnNilLength() -> u32:
|
||||
arr = nil
|
||||
<- arr.length
|
||||
|
||||
func stringNone() -> ?string:
|
||||
valueNone: ?string
|
||||
<- valueNone
|
||||
|
@ -16,6 +16,8 @@ import { parCall, testTimeoutCall } from '../examples/parCall';
|
||||
import { complexCall } from '../examples/complex';
|
||||
import { constantsCall, particleTtlAndTimestampCall } from '../examples/constantsCall';
|
||||
import {
|
||||
nilLengthCall,
|
||||
nilLiteralCall,
|
||||
returnNilCall,
|
||||
returnNoneCall, streamAssignmentCall,
|
||||
streamCall,
|
||||
@ -259,6 +261,16 @@ describe('Testing examples', () => {
|
||||
expect(streamResult).toEqual("333");
|
||||
})
|
||||
|
||||
it('stream.aqua nil literal', async () => {
|
||||
let result = await nilLiteralCall()
|
||||
expect(result).toEqual([]);
|
||||
})
|
||||
|
||||
it('stream.aqua nil length', async () => {
|
||||
let result = await nilLengthCall()
|
||||
expect(result).toEqual([]);
|
||||
})
|
||||
|
||||
it('stream.aqua int functor', async () => {
|
||||
let streamResult = await streamIntFunctorCall()
|
||||
expect(streamResult).toEqual("123");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
checkStreams,
|
||||
registerStringer,
|
||||
registerStringer, returnNilLength, returnNilLiteral,
|
||||
returnStreamFromFunc, streamAssignment,
|
||||
streamFunctor, streamIntFunctor, streamJoin,
|
||||
stringNil,
|
||||
@ -42,6 +42,14 @@ export async function streamAssignmentCall() {
|
||||
return await streamAssignment(["333"]);
|
||||
}
|
||||
|
||||
export async function nilLiteralCall() {
|
||||
return await returnNilLiteral();
|
||||
}
|
||||
|
||||
export async function nilLengthCall() {
|
||||
return await returnNilLength();
|
||||
}
|
||||
|
||||
export async function streamIntFunctorCall() {
|
||||
return await streamIntFunctor([0]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user