Add 'and' and 'or' operators (#5297)

This commit is contained in:
JT 2022-04-23 07:14:31 +12:00 committed by GitHub
parent 2a18206771
commit ee29a15119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -4000,8 +4000,8 @@ pub fn parse_operator(
b"in" => Operator::In,
b"not-in" => Operator::NotIn,
b"mod" => Operator::Modulo,
b"&&" => Operator::And,
b"||" => Operator::Or,
b"&&" | b"and" => Operator::And,
b"||" | b"or" => Operator::Or,
b"**" => Operator::Pow,
_ => {
return (

View File

@ -409,3 +409,8 @@ fn unary_not_6() -> TestResult {
fn date_literal() -> TestResult {
run_test(r#"2022-09-10 | date to-record | get day"#, "10")
}
#[test]
fn and_and_or() -> TestResult {
run_test(r#"true and false or true"#, "true")
}