From c104afbdce03f13e3be0c418b9142717140b1354 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 14 Nov 2020 18:30:26 +0800 Subject: [PATCH] Fix switch test. --- tests/switch.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/switch.rs b/tests/switch.rs index b5992005..5699da6d 100644 --- a/tests/switch.rs +++ b/tests/switch.rs @@ -64,13 +64,14 @@ fn test_switch() -> Result<(), Box> { } #[cfg(not(feature = "no_index"))] +#[cfg(not(feature = "no_object"))] mod test_switch_enum { use super::*; use rhai::Array; #[derive(Debug, Clone)] enum MyEnum { Foo, - Bar(i64), + Bar(INT), Baz(String, bool), } @@ -90,7 +91,9 @@ mod test_switch_enum { fn test_switch_enum() -> Result<(), Box> { let mut engine = Engine::new(); - engine.register_get("get_data", MyEnum::get_enum_data); + engine + .register_type_with_name::("MyEnum") + .register_get("get_data", MyEnum::get_enum_data); let mut scope = Scope::new(); scope.push("x", MyEnum::Baz("hello".to_string(), true));