mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-06-10 14:51:20 +00:00
Bracket notation not supported inside filter expression #38 - add unit test
This commit is contained in:
@ -244,4 +244,37 @@ fn bugs38_array_notation_in_filter() {
|
|||||||
]),
|
]),
|
||||||
json!([{"key": 42}]),
|
json!([{"key": 42}]),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
select_and_then_compare(
|
||||||
|
"$[?(@['key'].subKey == 'subKey2')]",
|
||||||
|
json!([
|
||||||
|
{"key": {"seq": 1, "subKey": "subKey1"}},
|
||||||
|
{"key": {"seq": 2, "subKey": "subKey2"}},
|
||||||
|
{"key": 42},
|
||||||
|
{"some": "value"}
|
||||||
|
]),
|
||||||
|
json!([{"key": {"seq": 2, "subKey": "subKey2"}}]),
|
||||||
|
);
|
||||||
|
|
||||||
|
select_and_then_compare(
|
||||||
|
"$[?(@['key']['subKey'] == 'subKey2')]",
|
||||||
|
json!([
|
||||||
|
{"key": {"seq": 1, "subKey": "subKey1"}},
|
||||||
|
{"key": {"seq": 2, "subKey": "subKey2"}},
|
||||||
|
{"key": 42},
|
||||||
|
{"some": "value"}
|
||||||
|
]),
|
||||||
|
json!([{"key": {"seq": 2, "subKey": "subKey2"}}]),
|
||||||
|
);
|
||||||
|
|
||||||
|
select_and_then_compare(
|
||||||
|
"$..key[?(@['subKey'] == 'subKey2')]",
|
||||||
|
json!([
|
||||||
|
{"key": {"seq": 1, "subKey": "subKey1"}},
|
||||||
|
{"key": {"seq": 2, "subKey": "subKey2"}},
|
||||||
|
{"key": 42},
|
||||||
|
{"some": "value"}
|
||||||
|
]),
|
||||||
|
json!([{"seq": 2, "subKey": "subKey2"}]),
|
||||||
|
);
|
||||||
}
|
}
|
Reference in New Issue
Block a user