fix tests

This commit is contained in:
Jaroslaw Konik 2025-05-21 21:58:16 +02:00
parent 992eb960cb
commit 992d19cba7
3 changed files with 8 additions and 5 deletions

View file

@ -1,5 +1,7 @@
fn test_func(vec3) {
if type_of(vec3) != "Vec3" { throw() }
// TODO: assert x,y,z
if vec3.x != 1.5 { throw() }
if vec3.y != 2.5 { throw() }
if vec3.z != -3.5 { throw() }
mark_success();
}

View file

@ -236,9 +236,9 @@ impl Default for RhaiRuntime {
.register_fn("new_vec3", |x: f64, y: f64, z: f64| {
BevyVec3(Vec3::new(x as f32, y as f32, z as f32))
})
.register_get("x", |vec: &mut Vec3| vec.x as f64)
.register_get("y", |vec: &mut Vec3| vec.y as f64)
.register_get("z", |vec: &mut Vec3| vec.z as f64);
.register_get("x", |vec: &mut BevyVec3| vec.x() as f64)
.register_get("y", |vec: &mut BevyVec3| vec.y() as f64)
.register_get("z", |vec: &mut BevyVec3| vec.z() as f64);
#[allow(deprecated)]
engine.on_def_var(|_, info, _| Ok(info.name != "entity"));

View file

@ -1,5 +1,6 @@
// TODO: install with CC=clang rbenv install 3.4.3
// TODO: adjust rhai examples and docs or maybe more rhai changes to different PR
// TODO: adjust rhai examples and docs or maybe more rhai changes to different PR or even better
// find a better way to test them(dont wrap, generic bevy etc)
use std::{
collections::HashMap,