From 765c34c52e3e9ccef97f38af651a176c36c9331f Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Sun, 18 May 2025 16:27:17 +0200 Subject: [PATCH] fix tests --- src/runtimes/lua.rs | 6 ++++++ tests/tests.rs | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/runtimes/lua.rs b/src/runtimes/lua.rs index 7ce1745..9d0962b 100644 --- a/src/runtimes/lua.rs +++ b/src/runtimes/lua.rs @@ -59,6 +59,12 @@ impl FromLua<'_> for BevyEntity { #[derive(Debug, Clone, Copy)] pub struct BevyVec3(pub Vec3); +impl BevyVec3 { + pub fn new(x: f32, y: f32, z: f32) -> Self { + BevyVec3(Vec3 { x, y, z }) + } +} + impl UserData for BevyVec3 {} impl FromLua<'_> for BevyVec3 { diff --git a/tests/tests.rs b/tests/tests.rs index 81894fe..fc2ecb2 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -554,6 +554,15 @@ mod rhai_tests { #[derive(Clone)] struct BevyEntity(Entity); + #[derive(Clone)] + struct BevyVec3(Vec3); + + impl BevyVec3 { + fn new(x: f32, y: f32, z: f32) -> Self { + Self(Vec3 { x, y, z }) + } + } + impl AssertStateKeyValue for RhaiRuntime { type ScriptData = RhaiScriptData; @@ -576,7 +585,7 @@ mod rhai_tests { } } - scripting_tests!(RhaiRuntime, "rhai", "rhai", BevyEntity); + scripting_tests!(RhaiRuntime, "rhai", "rhai", BevyEntity, BevyVec3); } #[cfg(feature = "lua")] @@ -618,7 +627,7 @@ mod lua_tests { } } - scripting_tests!(LuaRuntime, "lua", "lua", BevyEntity); + scripting_tests!(LuaRuntime, "lua", "lua", BevyEntity, BevyVec3); } #[cfg(feature = "ruby")]