Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash using Filter with $ #89

Open
oshadmi opened this issue Feb 15, 2022 · 1 comment · May be fixed by #90
Open

Crash using Filter with $ #89

oshadmi opened this issue Feb 15, 2022 · 1 comment · May be fixed by #90

Comments

@oshadmi
Copy link

oshadmi commented Feb 15, 2022

No description provided.

@oshadmi
Copy link
Author

oshadmi commented Feb 15, 2022

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 oshadmi linked a pull request Feb 15, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant