Add no_object feature to disable objects.

This commit is contained in:
Stephen Chung
2020-03-29 17:15:12 +08:00
parent a8a4ed2967
commit ef6c6ea6d2
16 changed files with 71 additions and 15 deletions

View File

@@ -12,12 +12,12 @@ fn test_math() -> Result<(), EvalAltResult> {
#[cfg(not(feature = "only_i32"))]
assert_eq!(
engine.eval::<INT>("(-9223372036854775807).abs()")?,
engine.eval::<INT>("abs(-9223372036854775807)")?,
9_223_372_036_854_775_807
);
#[cfg(feature = "only_i32")]
assert_eq!(engine.eval::<INT>("(-2147483647).abs()")?, 2147483647);
assert_eq!(engine.eval::<INT>("abs(-2147483647)")?, 2147483647);
// Overflow/underflow/division-by-zero errors
#[cfg(not(feature = "unchecked"))]
@@ -26,7 +26,7 @@ fn test_math() -> Result<(), EvalAltResult> {
{
assert!(matches!(
engine
.eval::<INT>("(-9223372036854775808).abs()")
.eval::<INT>("abs(-9223372036854775808)")
.expect_err("expects negation overflow"),
EvalAltResult::ErrorArithmetic(_, _)
));