Change fast_ops to options.

This commit is contained in:
Stephen Chung
2022-09-03 15:15:42 +08:00
parent 43c4d7e3ca
commit 06dea067b7
8 changed files with 53 additions and 48 deletions

View File

@@ -77,19 +77,22 @@ fn test_native_overload() -> Result<(), Box<EvalAltResult>> {
assert_eq!(
engine.eval::<String>(r#"let x = "hello"; let y = "world"; x + y"#)?,
if cfg!(not(feature = "fast_ops")) {
"hello***world"
} else {
"helloworld"
}
"hello***world"
);
assert_eq!(
engine.eval::<String>(r#"let x = "hello"; let y = (); x + y"#)?,
if cfg!(not(feature = "fast_ops")) {
"hello Foo!"
} else {
"hello"
}
"hello Foo!"
);
engine.set_fast_operators(true);
assert_eq!(
engine.eval::<String>(r#"let x = "hello"; let y = "world"; x + y"#)?,
"helloworld"
);
assert_eq!(
engine.eval::<String>(r#"let x = "hello"; let y = (); x + y"#)?,
"hello"
);
Ok(())