Path: blob/main/crates/bevy_reflect/src/impls/std/mod.rs
6600 views
mod collections;1mod ffi;2mod path;34#[cfg(test)]5mod tests {6use crate::{FromReflect, PartialReflect};7use std::collections::HashMap;8use std::path::Path;910#[test]11fn should_partial_eq_hash_map() {12let mut a = <HashMap<_, _>>::default();13a.insert(0usize, 1.23_f64);14let b = a.clone();15let mut c = <HashMap<_, _>>::default();16c.insert(0usize, 3.21_f64);1718let a: &dyn PartialReflect = &a;19let b: &dyn PartialReflect = &b;20let c: &dyn PartialReflect = &c;21assert!(a.reflect_partial_eq(b).unwrap_or_default());22assert!(!a.reflect_partial_eq(c).unwrap_or_default());23}2425#[test]26fn path_should_from_reflect() {27let path = Path::new("hello_world.rs");28let output = <&'static Path as FromReflect>::from_reflect(&path).unwrap();29assert_eq!(path, output);30}3132#[test]33fn type_id_should_from_reflect() {34let type_id = core::any::TypeId::of::<usize>();35let output = <core::any::TypeId as FromReflect>::from_reflect(&type_id).unwrap();36assert_eq!(type_id, output);37}3839#[test]40fn static_str_should_from_reflect() {41let expected = "Hello, World!";42let output = <&'static str as FromReflect>::from_reflect(&expected).unwrap();43assert_eq!(expected, output);44}45}464748