mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
eed44f448f
commit_hash:a80884f8d89a14490cb02e5278507f93ef7fb589
312 lines
6.5 KiB
JSON
312 lines
6.5 KiB
JSON
{
|
|
"cases": [
|
|
{
|
|
"name": "testRegex('a', 'a') => true",
|
|
"expression": "@{testRegex('a', 'a')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('b', 'a') => false",
|
|
"expression": "@{testRegex('b', 'a')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": false
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('abc', 'b') => true",
|
|
"description": "testRegex does not require that the whole string should match regex, only a part of it can match",
|
|
"expression": "@{testRegex('abc', 'b')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a', 'A') => false",
|
|
"description": "testRegex honors case",
|
|
"expression": "@{testRegex('a', 'A')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": false
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a', '[a-z]') => true",
|
|
"expression": "@{testRegex('a', '[a-z]')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('\\', '\\\\') => true",
|
|
"description": "Triple escape. Json, DivKit, and RegExp",
|
|
"expression": "@{testRegex('\\\\', '\\\\\\\\')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('abc', '(b)') => true",
|
|
"expression": "@{testRegex('abc', '(b)')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('5', '\\d') => true",
|
|
"expression": "@{testRegex('5', '\\\\d')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('ab', 'ac?b') => true",
|
|
"expression": "@{testRegex('ab', 'ac?b')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('ab', '^ab$') => true",
|
|
"expression": "@{testRegex('ab', '^ab$')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('abc', '^ab$') => false",
|
|
"expression": "@{testRegex('abc', '^ab$')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": false
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a', 'a{1,3}') => true",
|
|
"expression": "@{testRegex('a', 'a{1,3}')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a', 'a{2,3}') => false",
|
|
"expression": "@{testRegex('a', 'a{2,3}')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": false
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a', '(?:a)') => true",
|
|
"expression": "@{testRegex('a', '(?:a)')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('[]', '\\[]') => true",
|
|
"expression": "@{testRegex('[]', '\\\\[]')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('-', '[-]') => true",
|
|
"expression": "@{testRegex('-', '[-]')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a-b', '^[-ab]+$') => true",
|
|
"expression": "@{testRegex('a-b', '^[-ab]+$')}",
|
|
"expected": {
|
|
"type": "boolean",
|
|
"value": true
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('[', '[') => error",
|
|
"expression": "@{testRegex('[', '[')}",
|
|
"expected": {
|
|
"type": "error",
|
|
"value": "Failed to evaluate [testRegex('[', '[')]. Invalid regular expression."
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('(', '(') => error",
|
|
"expression": "@{testRegex('(', '(')}",
|
|
"expected": {
|
|
"type": "error",
|
|
"value": "Failed to evaluate [testRegex('(', '(')]. Invalid regular expression."
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"name": "testRegex('a', '\\') => error",
|
|
"expression": "@{testRegex('a', '\\\\')}",
|
|
"expected": {
|
|
"type": "error",
|
|
"value": "Failed to evaluate [testRegex('a', '\\\\')]. Invalid regular expression."
|
|
},
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"expression": "@{encodeRegex('')}",
|
|
"expected": {
|
|
"type": "string",
|
|
"value": ""
|
|
},
|
|
"platforms": [
|
|
"web",
|
|
"android",
|
|
"flutter"
|
|
]
|
|
},
|
|
{
|
|
"expression": "@{encodeRegex('.*+?^${}()|[]\\\\abcde12345')}",
|
|
"expected": {
|
|
"type": "string",
|
|
"value": "\\.\\*\\+\\?\\^\\$\\{\\}\\(\\)\\|\\[\\]\\\\abcde12345"
|
|
},
|
|
"platforms": [
|
|
"web",
|
|
"android",
|
|
"flutter"
|
|
]
|
|
}
|
|
]
|
|
}
|