Fix precedence parsing of parens. Limit use (#1606)

This commit is contained in:
Jonathan Turner
2020-04-19 06:39:06 +12:00
committed by GitHub
parent c2a9bc3bf4
commit a16a91ede8
3 changed files with 73 additions and 37 deletions

View File

@ -131,3 +131,15 @@ fn compound_where() {
assert_eq!(actual, r#"{"a":2,"b":1}"#);
}
#[test]
fn compound_where_paren() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
echo '[{"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 2, "b": 2}]' | from-json | where (a == 2 && b == 1) || b == 2 | to-json
"#
));
assert_eq!(actual, r#"[{"a":2,"b":1},{"a":2,"b":2}]"#);
}