jsonpath icon indicating copy to clipboard operation
jsonpath copied to clipboard

Crash using Filter with $

Open oshadmi opened this issue 3 years ago • 1 comments

oshadmi avatar Feb 15 '22 12:02 oshadmi

Add the following test to tests/filter.rs

#[test]
fn unsupported_in_filter() {
    setup();

    let json = json!([{
        "a": {"x": {"i": 10}},
        "b": {"x": {"i": 20, "j": 5}}
    }]);

    select_and_then_compare("$..x[?(@.i>10)]", json.clone(), json!([{"i": 20,"j": 5}]));

    // Should not panic ('empty term left')
    select_and_then_compare("$..x[?($.i>10)]", json.clone(), json!([]));
}

The filter ?($.i>10) panics ---- unsupported_in_filter stdout ---- thread 'unsupported_in_filter' panicked at 'empty term left', src/selector/selector_impl.rs:344:18 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

oshadmi avatar Feb 15 '22 13:02 oshadmi