Files
grechka62 adb30f1731 Enable expression tests for custom functions
commit_hash:32b930a51c3444c949bac85a138aa13a35c4f00a
2025-11-28 11:53:56 +03:00

111 lines
2.3 KiB
JSON

{
"cases": [
{
"expression": "@{equalsQuery('some string', 'one')}",
"expected": {
"type": "boolean",
"value": false
},
"functions": [
{
"name": "equalsQuery",
"body": "@{str == query}",
"return_type": "boolean",
"arguments": [
{
"name": "str",
"type": "string"
},
{
"name": "query",
"type": "string"
}
]
}
],
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{sumUp(2, 3)}",
"expected": {
"type": "integer",
"value": 5
},
"functions": [
{
"name": "sumUp",
"body": "@{num1 + num2}",
"return_type": "integer",
"arguments": [
{
"name": "num1",
"type": "integer"
},
{
"name": "num2",
"type": "integer"
}
]
}
],
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{testFunction + 1}",
"expected": {
"type": "error",
"value": "Failed to evaluate [testFunction + 1]. Operator '+' cannot be applied to different types: Function and Integer."
},
"variables": [],
"functions": [
{
"name": "testFunction",
"body": "@{'result'}",
"return_type": "string",
"arguments": [
{
"name": "item",
"type": "string"
}
]
}
],
"platforms": [
"web"
]
},
{
"expression": "@{toString(myFunction)}",
"expected": {
"type": "error",
"value": "Failed to evaluate [toString(myFunction)]. Function has no matching overload for given argument types: Function."
},
"variables": [],
"functions": [
{
"name": "myFunction",
"body": "@{num * 2}",
"return_type": "integer",
"arguments": [
{
"name": "num",
"type": "integer"
}
]
}
],
"platforms": [
"web"
]
}
]
}