diff --git a/examples/arrays_and_structs.rs b/examples/arrays_and_structs.rs index 374fc834..8b29d1a8 100644 --- a/examples/arrays_and_structs.rs +++ b/examples/arrays_and_structs.rs @@ -25,7 +25,7 @@ fn main() -> Result<(), Box> { .register_fn("update", TestStruct::update); let result = engine.eval::( - r" + " let x = new_ts(); x.update(); x @@ -35,7 +35,7 @@ fn main() -> Result<(), Box> { println!("{:?}", result); let result = engine.eval::( - r" + " let x = [ new_ts() ]; x[0].update(); x[0] diff --git a/examples/custom_types_and_methods.rs b/examples/custom_types_and_methods.rs index 4e06312c..fe1777f5 100644 --- a/examples/custom_types_and_methods.rs +++ b/examples/custom_types_and_methods.rs @@ -25,7 +25,7 @@ fn main() -> Result<(), Box> { .register_fn("update", TestStruct::update); let result = engine.eval::( - r" + " let x = new_ts(); x.update(); x diff --git a/src/engine_api.rs b/src/engine_api.rs index 918263d3..2df3a97d 100644 --- a/src/engine_api.rs +++ b/src/engine_api.rs @@ -1802,7 +1802,7 @@ impl Engine { /// /// let engine = Engine::new(); /// - /// let ast = engine.compile(r" + /// let ast = engine.compile(" /// fn add(x, y) { len(x) + y + foo } /// fn add1(x) { len(x) + 1 + foo } /// fn bar() { foo/2 } @@ -1873,7 +1873,7 @@ impl Engine { /// /// let engine = Engine::new(); /// - /// let ast = engine.compile(r" + /// let ast = engine.compile(" /// fn add(x, y) { len(x) + y + foo } /// fn add1(x) { len(x) + 1 + foo } /// fn bar() { foo/2 } diff --git a/tests/arrays.rs b/tests/arrays.rs index 3760305d..74cea10b 100644 --- a/tests/arrays.rs +++ b/tests/arrays.rs @@ -56,7 +56,7 @@ fn test_arrays() -> Result<(), Box> { assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [2, 9]; x.insert(-1, 1); x.insert(999, 3); @@ -76,7 +76,7 @@ fn test_arrays() -> Result<(), Box> { assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [1, 2, 3]; x += [4, 5]; x @@ -86,7 +86,7 @@ fn test_arrays() -> Result<(), Box> { ); assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [1, 2, 3]; let y = [4, 5]; x + y @@ -136,7 +136,7 @@ fn test_array_with_structs() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let a = [new_ts()]; a[0].x = 100; a[0].update(); @@ -158,7 +158,7 @@ fn test_arrays_map_reduce() -> Result<(), Box> { assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [1, 2, 3]; x.filter(|v| v > 2) " @@ -168,7 +168,7 @@ fn test_arrays_map_reduce() -> Result<(), Box> { assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [1, 2, 3]; x.filter(|v, i| v > i) " @@ -178,7 +178,7 @@ fn test_arrays_map_reduce() -> Result<(), Box> { assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [1, 2, 3]; x.map(|v| v * 2) " @@ -188,7 +188,7 @@ fn test_arrays_map_reduce() -> Result<(), Box> { assert_eq!( convert_to_vec::(engine.eval( - r" + " let x = [1, 2, 3]; x.map(|v, i| v * i) " diff --git a/tests/assignments.rs b/tests/assignments.rs index d3936223..03df4be8 100644 --- a/tests/assignments.rs +++ b/tests/assignments.rs @@ -21,41 +21,38 @@ fn test_assignments_bad_lhs() -> Result<(), Box> { let engine = Engine::new(); assert_eq!( - *engine.compile(r"(x+y) = 42;").expect_err("should error").0, + *engine.compile("(x+y) = 42;").expect_err("should error").0, ParseErrorType::AssignmentToInvalidLHS("".to_string()) ); assert_eq!( - *engine.compile(r"foo(x) = 42;").expect_err("should error").0, + *engine.compile("foo(x) = 42;").expect_err("should error").0, ParseErrorType::AssignmentToInvalidLHS("".to_string()) ); assert_eq!( - *engine.compile(r"true = 42;").expect_err("should error").0, + *engine.compile("true = 42;").expect_err("should error").0, ParseErrorType::AssignmentToConstant("".to_string()) ); assert_eq!( - *engine.compile(r"123 = 42;").expect_err("should error").0, + *engine.compile("123 = 42;").expect_err("should error").0, ParseErrorType::AssignmentToConstant("".to_string()) ); #[cfg(not(feature = "no_object"))] { + assert_eq!( + *engine.compile("x.foo() = 42;").expect_err("should error").0, + ParseErrorType::AssignmentToInvalidLHS("".to_string()) + ); assert_eq!( *engine - .compile(r"x.foo() = 42;") + .compile("x.foo().x.y = 42;") .expect_err("should error") .0, ParseErrorType::AssignmentToInvalidLHS("".to_string()) ); assert_eq!( *engine - .compile(r"x.foo().x.y = 42;") - .expect_err("should error") - .0, - ParseErrorType::AssignmentToInvalidLHS("".to_string()) - ); - assert_eq!( - *engine - .compile(r"x.y.z.foo() = 42;") + .compile("x.y.z.foo() = 42;") .expect_err("should error") .0, ParseErrorType::AssignmentToInvalidLHS("".to_string()) @@ -63,7 +60,7 @@ fn test_assignments_bad_lhs() -> Result<(), Box> { #[cfg(not(feature = "no_index"))] assert_eq!( *engine - .compile(r"x.foo()[0] = 42;") + .compile("x.foo()[0] = 42;") .expect_err("should error") .0, ParseErrorType::AssignmentToInvalidLHS("".to_string()) @@ -71,7 +68,7 @@ fn test_assignments_bad_lhs() -> Result<(), Box> { #[cfg(not(feature = "no_index"))] assert_eq!( *engine - .compile(r"x[y].z.foo() = 42;") + .compile("x[y].z.foo() = 42;") .expect_err("should error") .0, ParseErrorType::AssignmentToInvalidLHS("".to_string()) diff --git a/tests/bool_op.rs b/tests/bool_op.rs index 0520736d..18dc4ea6 100644 --- a/tests/bool_op.rs +++ b/tests/bool_op.rs @@ -38,7 +38,7 @@ fn test_bool_op_short_circuit() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = true; x || { throw; }; " @@ -48,7 +48,7 @@ fn test_bool_op_short_circuit() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = false; x && { throw; }; " @@ -65,7 +65,7 @@ fn test_bool_op_no_short_circuit1() { assert!(engine .eval::( - r" + " let x = true; x | { throw; } " @@ -79,7 +79,7 @@ fn test_bool_op_no_short_circuit2() { assert!(engine .eval::( - r" + " let x = false; x & { throw; } " diff --git a/tests/call_fn.rs b/tests/call_fn.rs index 07fdefda..cb9aa559 100644 --- a/tests/call_fn.rs +++ b/tests/call_fn.rs @@ -10,7 +10,7 @@ fn test_call_fn() -> Result<(), Box> { scope.push("foo", 42 as INT); let ast = engine.compile( - r" + " fn hello(x, y) { x + y } diff --git a/tests/chars.rs b/tests/chars.rs index 6882633a..1e6d0dbc 100644 --- a/tests/chars.rs +++ b/tests/chars.rs @@ -7,7 +7,7 @@ fn test_chars() -> Result<(), Box> { assert_eq!(engine.eval::("'y'")?, 'y'); assert_eq!(engine.eval::(r"'\''")?, '\''); assert_eq!(engine.eval::(r#"'"'"#)?, '"'); - assert_eq!(engine.eval::("'\\u2764'")?, '❤'); + assert_eq!(engine.eval::(r"'\u2764'")?, '❤'); #[cfg(not(feature = "no_index"))] { diff --git a/tests/closures.rs b/tests/closures.rs index 4b35e2d7..67ad11a9 100644 --- a/tests/closures.rs +++ b/tests/closures.rs @@ -54,7 +54,7 @@ fn test_closures() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let foo = #{ x: 42 }; let f = || { this.x }; foo.call(f) diff --git a/tests/comments.rs b/tests/comments.rs index 4c3452f7..91d7b200 100644 --- a/tests/comments.rs +++ b/tests/comments.rs @@ -33,7 +33,7 @@ fn test_comments_doc() -> Result<(), Box> { let mut engine = Engine::new(); let ast = engine.compile( - r" + " /// Hello world @@ -48,7 +48,7 @@ fn test_comments_doc() -> Result<(), Box> { assert!(engine .compile( - r" + " /// Hello world let x = 42; " @@ -56,7 +56,7 @@ fn test_comments_doc() -> Result<(), Box> { .is_err()); engine.compile( - r" + " /////////////// let x = 42; @@ -66,7 +66,7 @@ fn test_comments_doc() -> Result<(), Box> { )?; let ast = engine.compile( - r" + " /** Hello world ** how are you? **/ @@ -82,7 +82,7 @@ fn test_comments_doc() -> Result<(), Box> { assert!(engine .compile( - r" + " /** Hello world */ let x = 42; " @@ -92,7 +92,7 @@ fn test_comments_doc() -> Result<(), Box> { engine.enable_doc_comments(false); engine.compile( - r" + " /// Hello world! let x = 42; diff --git a/tests/constants.rs b/tests/constants.rs index b3432449..8c3c95af 100644 --- a/tests/constants.rs +++ b/tests/constants.rs @@ -59,7 +59,7 @@ fn test_constant_mut() -> Result<(), Box> { assert_eq!( engine.eval_with_scope::( &mut scope, - r" + " MY_NUMBER.update_value(42); MY_NUMBER.value ", diff --git a/tests/data_size.rs b/tests/data_size.rs index 3c67b4bc..f3ff3cd6 100644 --- a/tests/data_size.rs +++ b/tests/data_size.rs @@ -91,7 +91,7 @@ fn test_max_array_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = [1,2,3,4,5,6]; let y = [7,8,9,10,11,12]; x + y @@ -105,7 +105,7 @@ fn test_max_array_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = [1,2,3,4,5,6]; x.pad(100, 42); x @@ -118,7 +118,7 @@ fn test_max_array_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = [1,2,3]; [x, x, x, x] " @@ -131,7 +131,7 @@ fn test_max_array_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = #{a:1, b:2, c:3}; [x, x, x, x] " @@ -143,7 +143,7 @@ fn test_max_array_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = [1]; let y = [x, x]; let z = [y, y]; @@ -159,7 +159,7 @@ fn test_max_array_size() -> Result<(), Box> { assert_eq!( engine .eval::( - r" + " let x = [1,2,3,4,5,6]; let y = [7,8,9,10,11,12]; x + y @@ -172,7 +172,7 @@ fn test_max_array_size() -> Result<(), Box> { assert_eq!( engine .eval::( - r" + " let x = [1,2,3]; [x, x, x, x] " @@ -209,7 +209,7 @@ fn test_max_map_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = #{a:1,b:2,c:3,d:4,e:5,f:6}; let y = #{g:7,h:8,i:9,j:10,k:11,l:12}; x + y @@ -222,7 +222,7 @@ fn test_max_map_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = #{a:1,b:2,c:3}; #{u:x, v:x, w:x, z:x} " @@ -235,7 +235,7 @@ fn test_max_map_size() -> Result<(), Box> { assert!(matches!( *engine .eval::( - r" + " let x = [1, 2, 3]; #{u:x, v:x, w:x, z:x} " @@ -249,7 +249,7 @@ fn test_max_map_size() -> Result<(), Box> { assert_eq!( engine .eval::( - r" + " let x = #{a:1,b:2,c:3,d:4,e:5,f:6}; let y = #{g:7,h:8,i:9,j:10,k:11,l:12}; x + y @@ -262,7 +262,7 @@ fn test_max_map_size() -> Result<(), Box> { assert_eq!( engine .eval::( - r" + " let x = #{a:1,b:2,c:3}; #{u:x, v:x, w:x, z:x} " diff --git a/tests/for.rs b/tests/for.rs index 65bca46f..3118b8a7 100644 --- a/tests/for.rs +++ b/tests/for.rs @@ -5,7 +5,7 @@ use rhai::{Engine, EvalAltResult, Module, INT}; fn test_for() -> Result<(), Box> { let engine = Engine::new(); - let script = r" + let script = " let sum1 = 0; let sum2 = 0; let inputs = [1, 2, 3, 4, 5]; @@ -29,7 +29,7 @@ fn test_for() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let sum = 0; for x in range(1, 10, 2) { sum += x; } sum @@ -40,7 +40,7 @@ fn test_for() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let sum = 0; for x in range(10, 1, 2) { sum += x; } sum @@ -51,7 +51,7 @@ fn test_for() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let sum = 0; for x in range(1, 10, -2) { sum += x; } sum @@ -62,7 +62,7 @@ fn test_for() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let sum = 0; for x in range(10, 1, -2) { sum += x; } sum @@ -80,7 +80,7 @@ fn test_for_overflow() -> Result<(), Box> { let engine = Engine::new(); #[cfg(not(feature = "only_i32"))] - let script = r" + let script = " let sum = 0; for x in range(9223372036854775807, 0, 9223372036854775807) { @@ -90,7 +90,7 @@ fn test_for_overflow() -> Result<(), Box> { sum "; #[cfg(feature = "only_i32")] - let script = r" + let script = " let sum = 0; for x in range(2147483647 , 0, 2147483647 ) { diff --git a/tests/functions.rs b/tests/functions.rs index 1387f3eb..cd40c8ee 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -67,7 +67,7 @@ fn test_functions_namespaces() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " const ANSWER = 42; fn foo() { global::ANSWER } diff --git a/tests/if_block.rs b/tests/if_block.rs index eeb345a1..ca9eaa2d 100644 --- a/tests/if_block.rs +++ b/tests/if_block.rs @@ -13,7 +13,7 @@ fn test_if() -> Result<(), Box> { ); assert_eq!( engine.eval::( - r" + " if false { 55 } else if false { 33 } else if false { 66 } @@ -34,7 +34,7 @@ fn test_if_expr() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = 42; let y = 1 + if x > 40 { 100 } else { 0 } / x; y diff --git a/tests/internal_fn.rs b/tests/internal_fn.rs index b7bee8b6..eaa3364b 100644 --- a/tests/internal_fn.rs +++ b/tests/internal_fn.rs @@ -70,7 +70,7 @@ fn test_internal_fn_big() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " fn math_me(a, b, c, d, e, f) { a - b * c + d * e - f } @@ -89,7 +89,7 @@ fn test_internal_fn_overloading() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " fn abc(x,y,z) { 2*x + 3*y + 4*z + 888 } fn abc(x,y) { x + 2*y + 88 } fn abc() { 42 } @@ -104,7 +104,7 @@ fn test_internal_fn_overloading() -> Result<(), Box> { assert_eq!( *engine .compile( - r" + " fn abc(x) { x + 42 } fn abc(x) { x - 42 } " diff --git a/tests/looping.rs b/tests/looping.rs index 097297f7..8b99e1bd 100644 --- a/tests/looping.rs +++ b/tests/looping.rs @@ -6,7 +6,7 @@ fn test_loop() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = 0; let i = 0; diff --git a/tests/maps.rs b/tests/maps.rs index 170aed90..f668bc30 100644 --- a/tests/maps.rs +++ b/tests/maps.rs @@ -72,7 +72,7 @@ b`: 1}; y["a\nb"] ); assert_eq!( engine.eval::( - r" + " let x = #{a: 1, b: 2, c: 3}; let y = #{b: 42, d: 9}; x.mixin(y); @@ -83,7 +83,7 @@ b`: 1}; y["a\nb"] ); assert_eq!( engine.eval::( - r" + " let x = #{a: 1, b: 2, c: 3}; x += #{b: 42, d: 9}; x.len() + x.b @@ -94,7 +94,7 @@ b`: 1}; y["a\nb"] assert_eq!( engine .eval::( - r" + " let x = #{a: 1, b: 2, c: 3}; let y = #{b: 42, d: 9}; x + y diff --git a/tests/mismatched_op.rs b/tests/mismatched_op.rs index 1f259484..afbf9f40 100644 --- a/tests/mismatched_op.rs +++ b/tests/mismatched_op.rs @@ -30,7 +30,7 @@ fn test_mismatched_op_custom_type() -> Result<(), Box> { .register_type_with_name::("TestStruct") .register_fn("new_ts", TestStruct::new); - assert!(matches!(*engine.eval::(r" + assert!(matches!(*engine.eval::(" let x = new_ts(); let y = new_ts(); x == y diff --git a/tests/modules.rs b/tests/modules.rs index 03a2b477..b55e275d 100644 --- a/tests/modules.rs +++ b/tests/modules.rs @@ -381,13 +381,13 @@ fn test_module_export() -> Result<(), Box> { let engine = Engine::new(); assert!(matches!( - engine.compile(r"let x = 10; { export x; }").expect_err("should error"), + engine.compile("let x = 10; { export x; }").expect_err("should error"), ParseError(x, _) if *x == ParseErrorType::WrongExport )); #[cfg(not(feature = "no_function"))] assert!(matches!( - engine.compile(r"fn abc(x) { export x; }").expect_err("should error"), + engine.compile("fn abc(x) { export x; }").expect_err("should error"), ParseError(x, _) if *x == ParseErrorType::WrongExport )); diff --git a/tests/optimizer.rs b/tests/optimizer.rs index cd3baf58..2a457bff 100644 --- a/tests/optimizer.rs +++ b/tests/optimizer.rs @@ -5,9 +5,9 @@ use rhai::{Engine, EvalAltResult, OptimizationLevel, INT}; #[test] fn test_optimizer_run() -> Result<(), Box> { fn run_test(engine: &mut Engine) -> Result<(), Box> { - assert_eq!(engine.eval::(r"if true { 42 } else { 123 }")?, 42); + assert_eq!(engine.eval::("if true { 42 } else { 123 }")?, 42); assert_eq!( - engine.eval::(r"if 1 == 1 || 2 > 3 { 42 } else { 123 }")?, + engine.eval::("if 1 == 1 || 2 > 3 { 42 } else { 123 }")?, 42 ); assert_eq!( @@ -34,14 +34,14 @@ fn test_optimizer_run() -> Result<(), Box> { engine.set_optimization_level(OptimizationLevel::Simple); assert_eq!( - engine.eval::(r"if 1 == 1 || 2 > 3 { 42 } else { 123 }")?, + engine.eval::("if 1 == 1 || 2 > 3 { 42 } else { 123 }")?, 123 ); engine.set_optimization_level(OptimizationLevel::Full); assert_eq!( - engine.eval::(r"if 1 == 1 || 2 > 3 { 42 } else { 123 }")?, + engine.eval::("if 1 == 1 || 2 > 3 { 42 } else { 123 }")?, 123 ); diff --git a/tests/side_effects.rs b/tests/side_effects.rs index 52caabd2..6f729ded 100644 --- a/tests/side_effects.rs +++ b/tests/side_effects.rs @@ -49,7 +49,7 @@ fn test_side_effects_command() -> Result<(), Box> { assert_eq!( engine.eval_with_scope::( &mut scope, - r" + " // Drive the command object via the wrapper Command.action(30); Command.value diff --git a/tests/stack.rs b/tests/stack.rs index 281c2d87..527522bf 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -8,7 +8,7 @@ fn test_stack_overflow_fn_calls() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " fn foo(n) { if n <= 1 { 0 } else { n + foo(n-1) } } foo(6) ", @@ -22,7 +22,7 @@ fn test_stack_overflow_fn_calls() -> Result<(), Box> { assert!(matches!( *engine .eval::<()>(&format!( - r" + " fn foo(n) {{ if n == 0 {{ 0 }} else {{ n + foo(n-1) }} }} foo({}) ", @@ -40,7 +40,7 @@ fn test_stack_overflow_parsing() -> Result<(), Box> { let mut engine = Engine::new(); assert_eq!( - *engine.compile(r" + *engine.compile(" let a = (1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(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))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ").expect_err("should error").0, ParseErrorType::ExprTooDeep @@ -54,7 +54,7 @@ fn test_stack_overflow_parsing() -> Result<(), Box> { engine.compile("1 + 2")?; 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 + @@ -71,7 +71,7 @@ fn test_stack_overflow_parsing() -> Result<(), Box> { 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 + diff --git a/tests/string.rs b/tests/string.rs index 99e51606..139b87a8 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -319,7 +319,7 @@ fn test_string_interpolated() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = 40; `hello ${x+2} worlds!` " @@ -339,7 +339,7 @@ fn test_string_interpolated() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " const x = 42; `hello ${x} worlds!` " @@ -351,7 +351,7 @@ fn test_string_interpolated() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " const x = 42; `${x} worlds!` " @@ -361,7 +361,7 @@ fn test_string_interpolated() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " const x = 42; `hello ${x}` " @@ -371,7 +371,7 @@ fn test_string_interpolated() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " const x = 20; `hello ${let y = x + 1; `${y * 2}`} worlds!` " diff --git a/tests/switch.rs b/tests/switch.rs index db0d8e17..614d0876 100644 --- a/tests/switch.rs +++ b/tests/switch.rs @@ -33,7 +33,7 @@ fn test_switch() -> Result<(), Box> { assert_eq!( engine.eval_with_scope::( &mut scope, - r" + " let y = [1, 2, 3]; switch y { @@ -50,7 +50,7 @@ fn test_switch() -> Result<(), Box> { assert_eq!( engine.eval_with_scope::( &mut scope, - r" + " let y = #{a:1, b:true, c:'x'}; switch y { @@ -98,7 +98,7 @@ fn test_switch_condition() -> Result<(), Box> { assert_eq!( engine.eval_with_scope::( &mut scope, - r" + " switch x / 2 { 21 if x > 40 => 1, 0 if x < 100 => 2, @@ -113,7 +113,7 @@ fn test_switch_condition() -> Result<(), Box> { assert_eq!( engine.eval_with_scope::( &mut scope, - r" + " switch x / 2 { 21 if x < 40 => 1, 0 if x < 100 => 2, @@ -128,7 +128,7 @@ fn test_switch_condition() -> Result<(), Box> { assert!(matches!( *engine .compile( - r" + " switch x { 21 if x < 40 => 1, 21 if x == 10 => 10, diff --git a/tests/syntax.rs b/tests/syntax.rs index 55272f54..5dd03d9a 100644 --- a/tests/syntax.rs +++ b/tests/syntax.rs @@ -57,7 +57,7 @@ fn test_custom_syntax() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = 0; let foo = (exec |x| -> { x += 2 } while x < 42) * 10; foo @@ -67,7 +67,7 @@ fn test_custom_syntax() -> Result<(), Box> { ); assert_eq!( engine.eval::( - r" + " let x = 0; exec |x| -> { x += 1 } while x < 42; x @@ -77,7 +77,7 @@ fn test_custom_syntax() -> Result<(), Box> { ); assert_eq!( engine.eval::( - r" + " exec |x| -> { x += 1 } while x < 42; x " diff --git a/tests/time.rs b/tests/time.rs index 94de7933..43778b38 100644 --- a/tests/time.rs +++ b/tests/time.rs @@ -40,7 +40,7 @@ fn test_timestamp() -> Result<(), Box> { ); assert!(engine.eval::( - r" + " let time1 = timestamp(); for x in range(0, 10000) {} let time2 = timestamp(); diff --git a/tests/tokens.rs b/tests/tokens.rs index b8343a69..3da33e39 100644 --- a/tests/tokens.rs +++ b/tests/tokens.rs @@ -49,7 +49,7 @@ fn test_tokens_custom_operator_identifiers() -> Result<(), Box> { #[cfg(not(feature = "no_function"))] assert_eq!( engine.eval::( - r" + " fn foo(x, y) { y - x } 1 + 2 * 3 foo 4 - 5 / 6 " @@ -87,7 +87,7 @@ fn test_tokens_custom_operator_symbol() -> Result<(), Box> { fn test_tokens_unicode_xid_ident() -> Result<(), Box> { let engine = Engine::new(); let result = engine.eval::( - r" + " fn すべての答え() { 42 } すべての答え() ", @@ -99,7 +99,7 @@ fn test_tokens_unicode_xid_ident() -> Result<(), Box> { assert!(result.is_err()); let result = engine.eval::( - r" + " fn _1() { 1 } _1() ", diff --git a/tests/while_loop.rs b/tests/while_loop.rs index 35a71dae..222ce7b1 100644 --- a/tests/while_loop.rs +++ b/tests/while_loop.rs @@ -6,7 +6,7 @@ fn test_while() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = 0; while x < 10 { @@ -31,7 +31,7 @@ fn test_do() -> Result<(), Box> { assert_eq!( engine.eval::( - r" + " let x = 0; do {