Do not default compares of different types.

This commit is contained in:
Stephen Chung
2023-03-08 21:47:57 +08:00
parent fa4096e91e
commit 58fad030ee
8 changed files with 125 additions and 161 deletions

View File

@@ -39,7 +39,10 @@ fn test_mismatched_op_custom_type() -> Result<(), Box<EvalAltResult>> {
").expect_err("should error"),
EvalAltResult::ErrorFunctionNotFound(f, ..) if f == "== (TestStruct, TestStruct)"));
assert!(!engine.eval::<bool>("new_ts() == 42")?);
assert!(
matches!(*engine.eval::<bool>("new_ts() == 42").expect_err("should error"),
EvalAltResult::ErrorFunctionNotFound(f, ..) if f.starts_with("== (TestStruct, "))
);
assert!(matches!(
*engine.eval::<INT>("60 + new_ts()").expect_err("should error"),