Fix tests.

This commit is contained in:
Stephen Chung 2022-10-29 12:56:35 +08:00
parent c14fbdb14d
commit 68bd84417a
2 changed files with 5 additions and 1 deletions

View File

@ -239,8 +239,10 @@ impl Engine {
engine.print = Box::new(|s| println!("{s}")); engine.print = Box::new(|s| println!("{s}"));
engine.debug = Box::new(|s, source, pos| match (source, pos) { engine.debug = Box::new(|s, source, pos| match (source, pos) {
(Some(source), crate::Position::NONE) => println!("{source} | {s}"), (Some(source), crate::Position::NONE) => println!("{source} | {s}"),
#[cfg(not(feature = "no_position"))]
(Some(source), pos) => println!("{source} @ {pos:?} | {s}"), (Some(source), pos) => println!("{source} @ {pos:?} | {s}"),
(None, crate::Position::NONE) => println!("{s}"), (None, crate::Position::NONE) => println!("{s}"),
#[cfg(not(feature = "no_position"))]
(None, pos) => println!("{pos:?} | {s}"), (None, pos) => println!("{pos:?} | {s}"),
}); });
} }

View File

@ -231,10 +231,12 @@ fn test_for_loop() -> Result<(), Box<EvalAltResult>> {
); );
} }
#[cfg(not(feature = "no_index"))]
#[cfg(not(feature = "no_object"))]
assert_eq!( assert_eq!(
engine.eval::<INT>( engine.eval::<INT>(
r#" 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 { for (item, count) in a {
switch item.type_of() { switch item.type_of() {