You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
3.0 KiB
94 lines
3.0 KiB
1 year ago
|
---
|
||
|
test case: Expand '={?{last(/{HOST.KEY}/key[{#A}]}}=' with {#A}=[]
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"a":"[]"}'
|
||
|
macros:
|
||
|
- {macro: '{#A}', path: $.a}
|
||
|
expression: '={?{last(/{HOST.KEY}/key[{#A}]}}='
|
||
|
out:
|
||
|
expression: '={?{last(/{HOST.KEY}/key[[]]}}='
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand 'Expression:{?last(/host/key) = "{#A}" }.' with {#A}=value:"xyz"
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"a":"value:\"xyz\""}'
|
||
|
macros:
|
||
|
- {macro: '{#A}', path: $.a}
|
||
|
expression: 'Expression:{?last(/host/key) = "{#A}" }.'
|
||
|
out:
|
||
|
expression: 'Expression:{?last(/host/key) = "value:\"xyz\"" }.'
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand '={?last(/host/key[{#A}],,{#A})}=' with {#A}=()
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"a":"()"}'
|
||
|
macros:
|
||
|
- {macro: '{#A}', path: $.a}
|
||
|
expression: '={?last(/host/key[{#A}],,{#A})}='
|
||
|
out:
|
||
|
expression: '={?last(/host/key[()],,"()")}='
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand '={?func({#A})}=' with {#A}=()
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"a":"()"}'
|
||
|
macros:
|
||
|
- {macro: '{#A}', path: $.a}
|
||
|
expression: '={?func({#A})}='
|
||
|
out:
|
||
|
expression: '={?func("()")}='
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand '{?{$MACRO:"{#A}"} {?last(/host/key[{#B1},{#B2}],{#B1},{#B2})}' with {#A}=x"z, {#B1}=[], {#B2}=()
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"a":"x\"z", "b1":"[]", "b2":"()"}'
|
||
|
macros:
|
||
|
- {macro: '{#A}', path: $.a}
|
||
|
- {macro: '{#B1}', path: $.b1}
|
||
|
- {macro: '{#B2}', path: $.b2}
|
||
|
expression: '{?{$MACRO:"{#A}"} {?last(/host/key[{#B1},{#B2}],{#B1},{#B2})}'
|
||
|
out:
|
||
|
expression: '{?{$MACRO:"x\"z"} {?last(/host/key["[]",()],[],"()")}'
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand '{?last(/host/key[{#B1},{#B2}],{#B1},{#B2})} last(/host/key[{#B1},{#B2}],{#B1},{#B2})' with {#B1}=[], {#B2}=()
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"b1":"[]", "b2":"()"}'
|
||
|
macros:
|
||
|
- {macro: '{#B1}', path: $.b1}
|
||
|
- {macro: '{#B2}', path: $.b2}
|
||
|
expression: '{?last(/host/key[{#B1},{#B2}],{#B1},{#B2})} last(/host/key[{#B1},{#B2}],{#B1},{#B2})'
|
||
|
out:
|
||
|
expression: '{?last(/host/key["[]",()],[],"()")} last(/host/key[[],()],[],())'
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand '{?last(/host/key[{#B1},{#B2}],{#B1},{#B2})} {?last(/host/key[{#B2},{#B1}],{#B2},{#B1})}' with {#B1}=[], {#B2}=()
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"b1":"[]", "b2":"()"}'
|
||
|
macros:
|
||
|
- {macro: '{#B1}', path: $.b1}
|
||
|
- {macro: '{#B2}', path: $.b2}
|
||
|
expression: '{?last(/host/key[{#B1},{#B2}],{#B1},{#B2})} {?last(/host/key[{#B2},{#B1}],{#B2},{#B1})}'
|
||
|
out:
|
||
|
expression: '{?last(/host/key["[]",()],[],"()")} {?last(/host/key[(),"[]"],(),"[]")}'
|
||
|
return: SUCCEED
|
||
|
---
|
||
|
test case: Expand 'Expression:{?last(/host/key) {#A} }.' with {#A}='= "xyz"'
|
||
|
in:
|
||
|
flags: [ZBX_MACRO_ANY, ZBX_TOKEN_EXPRESSION_MACRO]
|
||
|
lld: '{"a":"= \"xyz\""}'
|
||
|
macros:
|
||
|
- {macro: '{#A}', path: $.a}
|
||
|
expression: 'Expression:{?last(/host/key) {#A} }.'
|
||
|
out:
|
||
|
expression: 'Expression:{?last(/host/key) = "xyz" }.'
|
||
|
return: SUCCEED
|
||
|
...
|