diff --git a/tests/closures.rs b/tests/closures.rs index ff4cc431..cfa1f355 100644 --- a/tests/closures.rs +++ b/tests/closures.rs @@ -324,7 +324,7 @@ fn test_closures_external() -> Result<(), Box> { r#" let test = "hello"; |x| test + x - "#, + "#, )?; // Save the function pointer together with captured variables diff --git a/tests/expressions.rs b/tests/expressions.rs index e6c09b5c..13588d0d 100644 --- a/tests/expressions.rs +++ b/tests/expressions.rs @@ -67,7 +67,7 @@ fn test_expressions_eval() -> Result<(), Box> { let result: bool = engine.eval_expression_with_scope( &mut scope, r#" - agent.age > 10 && agent.gender == "male" + agent.age > 10 && agent.gender == "male" "#, )?; diff --git a/tests/functions.rs b/tests/functions.rs index d2db1128..5cbdcf3f 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -242,19 +242,19 @@ fn test_function_is_def() -> Result<(), Box> { r#" fn foo(x) { x + 1 } is_def_fn("foo", 1) - "# + "# )?); assert!(!engine.eval::( r#" fn foo(x) { x + 1 } is_def_fn("bar", 1) - "# + "# )?); assert!(!engine.eval::( r#" fn foo(x) { x + 1 } is_def_fn("foo", 0) - "# + "# )?); Ok(()) diff --git a/tests/if_block.rs b/tests/if_block.rs index a5d5125a..eeb345a1 100644 --- a/tests/if_block.rs +++ b/tests/if_block.rs @@ -20,7 +20,7 @@ fn test_if() -> Result<(), Box> { else if false { 77 } else if false { 88 } else { 44 } - " + " )?, 44 ); @@ -38,7 +38,7 @@ fn test_if_expr() -> Result<(), Box> { let x = 42; let y = 1 + if x > 40 { 100 } else { 0 } / x; y - " + " )?, 3 ); diff --git a/tests/looping.rs b/tests/looping.rs index 23f87bb0..097297f7 100644 --- a/tests/looping.rs +++ b/tests/looping.rs @@ -21,7 +21,7 @@ fn test_loop() -> Result<(), Box> { } return x; - " + " )?, 21 ); diff --git a/tests/operations.rs b/tests/operations.rs index 6b812958..bcc9019f 100644 --- a/tests/operations.rs +++ b/tests/operations.rs @@ -43,24 +43,24 @@ fn test_max_operations_functions() -> Result<(), Box> { engine.eval::<()>( r#" - print("Test1"); - let x = 0; + print("Test1"); + let x = 0; - while x < 28 { - print(x); - x += 1; - } - "#, + while x < 28 { + print(x); + x += 1; + } + "#, )?; #[cfg(not(feature = "no_function"))] engine.eval::<()>( r#" - print("Test2"); - fn inc(x) { x + 1 } - let x = 0; - while x < 20 { x = inc(x); } - "#, + print("Test2"); + fn inc(x) { x + 1 } + let x = 0; + while x < 20 { x = inc(x); } + "#, )?; #[cfg(not(feature = "no_function"))] @@ -76,7 +76,7 @@ fn test_max_operations_functions() -> Result<(), Box> { print(x); x = inc(x); } - "#, + "#, ) .expect_err("should error"), EvalAltResult::ErrorTooManyOperations(_) @@ -103,7 +103,7 @@ fn test_max_operations_eval() -> Result<(), Box> { r#" let script = "for x in range(0, 500) {}"; eval(script); - "# + "# ) .expect_err("should error"), EvalAltResult::ErrorInFunctionCall(_, _, err, _) if matches!(*err, EvalAltResult::ErrorTooManyOperations(_)) diff --git a/tests/stack.rs b/tests/stack.rs index 03f1c083..281c2d87 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -65,24 +65,24 @@ fn test_stack_overflow_parsing() -> Result<(), Box> { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 - ", + ", )?; assert_eq!( *engine .compile( r" - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + - 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 - " + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + " ) .expect_err("should error") .0, diff --git a/tests/time.rs b/tests/time.rs index 54240db8..94de7933 100644 --- a/tests/time.rs +++ b/tests/time.rs @@ -23,7 +23,7 @@ fn test_timestamp() -> Result<(), Box> { let x = 10_000; while x > 0 { x -= 1; } elapsed(time) - "# + "# )? < 10.0 ); @@ -35,7 +35,7 @@ fn test_timestamp() -> Result<(), Box> { let x = 10_000; while x > 0 { x -= 1; } elapsed(time) - "# + "# )? < 10 ); @@ -62,7 +62,7 @@ fn test_timestamp_op() -> Result<(), Box> { let time1 = timestamp(); let time2 = time1 + 123.45; time2 - time1 - "# + "# )? - 123.45) .abs() < 0.001 @@ -75,7 +75,7 @@ fn test_timestamp_op() -> Result<(), Box> { let time1 = timestamp(); let time2 = time1 - 123.45; time1 - time2 - "# + "# )? - 123.45) .abs() < 0.001 @@ -88,7 +88,7 @@ fn test_timestamp_op() -> Result<(), Box> { let time1 = timestamp(); let time2 = time1 + 42; time2 - time1 - "# + "# )?, 42 ); @@ -100,7 +100,7 @@ fn test_timestamp_op() -> Result<(), Box> { let time1 = timestamp(); let time2 = time1 - 42; time1 - time2 - "# + "# )?, 42 ); diff --git a/tests/var_scope.rs b/tests/var_scope.rs index 09cf8730..082a294b 100644 --- a/tests/var_scope.rs +++ b/tests/var_scope.rs @@ -27,19 +27,19 @@ fn test_var_is_def() -> Result<(), Box> { r#" let x = 42; is_def_var("x") - "# + "# )?); assert!(!engine.eval::( r#" let x = 42; is_def_var("y") - "# + "# )?); assert!(engine.eval::( r#" const x = 42; is_def_var("x") - "# + "# )?); Ok(()) diff --git a/tests/while_loop.rs b/tests/while_loop.rs index f9b74846..35a71dae 100644 --- a/tests/while_loop.rs +++ b/tests/while_loop.rs @@ -17,7 +17,7 @@ fn test_while() -> Result<(), Box> { } x - ", + ", )?, 6 ); @@ -42,7 +42,7 @@ fn test_do() -> Result<(), Box> { } while x < 10; x - ", + ", )?, 6 );