Fix no_index build.
This commit is contained in:
@@ -46,28 +46,26 @@ fn test_get_set() -> Result<(), Box<EvalAltResult>> {
|
||||
assert_eq!(engine.eval::<INT>("let a = new_ts(); a.x.add(); a.x")?, 42);
|
||||
assert_eq!(engine.eval::<INT>("let a = new_ts(); a.y.add(); a.y")?, 0);
|
||||
|
||||
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||
{
|
||||
engine.register_indexer_get_set(
|
||||
|value: &mut TestStruct, index: &str| value.array[index.len()],
|
||||
|value: &mut TestStruct, index: &str, new_val: INT| value.array[index.len()] = new_val,
|
||||
);
|
||||
engine.register_indexer_get_set(
|
||||
|value: &mut TestStruct, index: &str| value.array[index.len()],
|
||||
|value: &mut TestStruct, index: &str, new_val: INT| value.array[index.len()] = new_val,
|
||||
);
|
||||
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
assert_eq!(engine.eval::<INT>(r#"let a = new_ts(); a["abc"]"#)?, 4);
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
assert_eq!(engine.eval::<INT>(r#"let a = new_ts(); a["abc"]"#)?, 4);
|
||||
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
assert_eq!(
|
||||
engine.eval::<INT>(r#"let a = new_ts(); a["abc"] = 42; a["abc"]"#)?,
|
||||
42
|
||||
);
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
assert_eq!(
|
||||
engine.eval::<INT>(r#"let a = new_ts(); a["abc"] = 42; a["abc"]"#)?,
|
||||
42
|
||||
);
|
||||
|
||||
assert_eq!(engine.eval::<INT>(r"let a = new_ts(); a.abc")?, 4);
|
||||
assert_eq!(
|
||||
engine.eval::<INT>(r"let a = new_ts(); a.abc = 42; a.abc")?,
|
||||
42
|
||||
);
|
||||
|
||||
assert_eq!(engine.eval::<INT>(r"let a = new_ts(); a.abc")?, 4);
|
||||
assert_eq!(
|
||||
engine.eval::<INT>(r"let a = new_ts(); a.abc = 42; a.abc")?,
|
||||
42
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user