Preserve false in single-expression queries (#145)

Note: 1 = 2 is different from 1 == 2
See issue for details

fixes #144

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2024-02-16 06:11:07 -08:00
committed by GitHub
parent 7d32bd9377
commit 8d282f1ffd
5 changed files with 90 additions and 13 deletions

View File

@@ -234,6 +234,7 @@ struct TestCase {
query: String,
sort_bindings: Option<bool>,
want_result: Option<ValueOrVec>,
no_result: Option<bool>,
skip: Option<bool>,
error: Option<String>,
traces: Option<bool>,
@@ -267,7 +268,10 @@ fn yaml_test_impl(file: &str) -> Result<()> {
match (&case.want_result, &case.error) {
(Some(_), None) | (None, Some(_)) => (),
_ => panic!("either want_result or error must be specified in test case."),
_ if case.no_result != Some(true) => {
panic!("either want_result, error or no_result must be specified in test case.")
}
_ => (),
}
let enable_tracing = case.traces.is_some() && case.traces.unwrap();
@@ -292,6 +296,7 @@ fn yaml_test_impl(file: &str) -> Result<()> {
check_output(&results, &expected_results)?;
}
_ if case.no_result == Some(true) => (),
_ => bail!("eval succeeded and did not produce any errors"),
},
Err(actual) => match &case.error {