Merge branch 'plugins_dev' of https://github.com/schungx/rhai into plugins
This commit is contained in:
@@ -24,6 +24,13 @@ mod test {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hash(_text: String) -> INT {
|
||||
42
|
||||
}
|
||||
pub fn hash2(_text: &str) -> INT {
|
||||
42
|
||||
}
|
||||
|
||||
#[rhai_fn(name = "test", name = "hi")]
|
||||
#[inline(always)]
|
||||
pub fn len(array: &mut Array, mul: INT) -> INT {
|
||||
@@ -77,6 +84,8 @@ fn test_plugins_package() -> Result<(), Box<EvalAltResult>> {
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; a.foo")?, 1);
|
||||
|
||||
assert_eq!(engine.eval::<INT>(r#"hash("hello")"#)?, 42);
|
||||
assert_eq!(engine.eval::<INT>(r#"hash2("hello")"#)?, 42);
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; test(a, 2)")?, 6);
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; hi(a, 2)")?, 6);
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; test(a, 2)")?, 6);
|
||||
|
Reference in New Issue
Block a user