diff --git a/cts.json b/cts.json index 35ec022..7c22106 100644 --- a/cts.json +++ b/cts.json @@ -3819,6 +3819,48 @@ "selector": "$[-1:-10:-231584178474632390847141970017375815706539969331281128078915168015826259279872]", "invalid_selector": true }, + { + "name": "functions, arguments, parenthesized expression", + "selector": "$[?match((@.a), ('a.*'))]", + "document": [ + { + "a": "ab" + }, + { + "a": "ba" + } + ], + "result": [ + { + "a": "ab" + } + ] + }, + { + "name": "functions, arguments, function expression", + "selector": "$.values[?match(@.a, value($..['regex']))]", + "document": { + "regex": "a.*", + "values": [ + { + "a": "ab" + }, + { + "a": "ba" + } + ] + }, + "result": [ + { + "a": "ab" + } + ] + }, + { + "name": "functions, arguments, type mismatch, value type and logical type", + "selector": "$[?length(@.a==@.b)>2]", + "invalid_selector": true + }, { "name": "functions, count, count function", "selector": "$[?count(@..*)>2]", diff --git a/tests/functions/arguments.json b/tests/functions/arguments.json new file mode 100644 index 0000000..0171501 --- /dev/null +++ b/tests/functions/arguments.json @@ -0,0 +1,25 @@ +{ + "tests": [ + { + "name": "parenthesized expression", + "selector": "$[?match((@.a), ('a.*'))]", + "document" : [{"a": "ab"}, {"a": "ba"}], + "result": [ + {"a": "ab"} + ] + }, + { + "name": "function expression", + "selector": "$.values[?match(@.a, value($..['regex']))]", + "document" : {"regex": "a.*", "values": [{"a": "ab"}, {"a": "ba"}]}, + "result": [ + {"a": "ab"} + ] + }, + { + "name": "type mismatch, value type and logical type", + "selector": "$[?length(@.a==@.b)>2]", + "invalid_selector": true + } + ] +}