From df72d324ba7264af8bb866fbe42be1c2e864af83 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 17 Nov 2020 12:40:12 +0800 Subject: [PATCH] Fix tests. --- codegen/ui_tests/rhai_fn_global_multiple.stderr | 4 ++-- doc/src/plugins/module.md | 7 ++++--- tests/modules.rs | 6 ------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/codegen/ui_tests/rhai_fn_global_multiple.stderr b/codegen/ui_tests/rhai_fn_global_multiple.stderr index 328c641b..f66ebbb7 100644 --- a/codegen/ui_tests/rhai_fn_global_multiple.stderr +++ b/codegen/ui_tests/rhai_fn_global_multiple.stderr @@ -4,8 +4,8 @@ error: conflicting namespace 12 | #[rhai_fn(global, global)] | ^^^^^^ -error[E0433]: failed to resolve: use of undeclared type or module `test_module` +error[E0433]: failed to resolve: use of undeclared crate or module `test_module` --> $DIR/rhai_fn_global_multiple.rs:23:8 | 23 | if test_module::test_fn(n) { - | ^^^^^^^^^^^ use of undeclared type or module `test_module` + | ^^^^^^^^^^^ use of undeclared crate or module `test_module` diff --git a/doc/src/plugins/module.md b/doc/src/plugins/module.md index 9c4c6ccd..ee55ab96 100644 --- a/doc/src/plugins/module.md +++ b/doc/src/plugins/module.md @@ -161,9 +161,10 @@ service::increment(x); x == 43; ``` -Any functions (usually _methods_) defined in the module with `#[rhai_fn(global)]`, as well as -all _type iterators_, are automatically exposed to the _global_ namespace, so iteration, -[getters/setters] and [indexers] for [custom types] can work as expected. +All functions (usually _methods_) defined in the module and marked with `#[rhai_fn(global)]`, +as well as all _type iterators_, are automatically exposed to the _global_ namespace, so +[iteration]({{rootUrl}}/language/for.md), [getters/setters] and [indexers] for [custom types] +can work as expected. Therefore, in the example above, the `increment` method (defined with `#[rhai_fn(global)]`) works fine when called in method-call style: diff --git a/tests/modules.rs b/tests/modules.rs index 400e7c54..de8e4de3 100644 --- a/tests/modules.rs +++ b/tests/modules.rs @@ -57,16 +57,10 @@ fn test_module_sub_module() -> Result<(), Box> { assert!(engine .eval::("inc(question::life::universe::answer)") .is_err()); - - #[cfg(not(feature = "no_object"))] assert_eq!( engine.eval::("super_inc(question::life::universe::answer)")?, 42 ); - #[cfg(feature = "no_object")] - assert!(engine - .eval::("super_inc(question::life::universe::answer)") - .is_err()); Ok(()) }