mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-03-15 06:50:50 +00:00
Bracket notation not supported inside filter expression #38 - add unit test
This commit is contained in:
parent
d618e60e13
commit
ef52c63bc8
@ -244,4 +244,37 @@ fn bugs38_array_notation_in_filter() {
|
||||
]),
|
||||
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"}]),
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user