From 68bd84417aa79c0427a6e89a1c430cebc162d83a Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 29 Oct 2022 12:56:35 +0800 Subject: [PATCH] Fix tests. --- src/engine.rs | 2 ++ tests/for.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine.rs b/src/engine.rs index 8071b9de..0afadf75 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -239,8 +239,10 @@ impl Engine { engine.print = Box::new(|s| println!("{s}")); engine.debug = Box::new(|s, source, pos| match (source, pos) { (Some(source), crate::Position::NONE) => println!("{source} | {s}"), + #[cfg(not(feature = "no_position"))] (Some(source), pos) => println!("{source} @ {pos:?} | {s}"), (None, crate::Position::NONE) => println!("{s}"), + #[cfg(not(feature = "no_position"))] (None, pos) => println!("{pos:?} | {s}"), }); } diff --git a/tests/for.rs b/tests/for.rs index af2eed86..63c8ae92 100644 --- a/tests/for.rs +++ b/tests/for.rs @@ -231,10 +231,12 @@ fn test_for_loop() -> Result<(), Box> { ); } + #[cfg(not(feature = "no_index"))] + #[cfg(not(feature = "no_object"))] assert_eq!( engine.eval::( r#" - let a = [123, 999, 42, 0, true, "hello", "world!", 987.6543]; + let a = [123, 999, 42, 0, true, "hello", "world!"]; for (item, count) in a { switch item.type_of() {