mod collections;
mod ffi;
mod path;
#[cfg(test)]
mod tests {
use crate::{FromReflect, PartialReflect};
use std::collections::HashMap;
use std::path::Path;
#[test]
fn should_partial_eq_hash_map() {
let mut a = <HashMap<_, _>>::default();
a.insert(0usize, 1.23_f64);
let b = a.clone();
let mut c = <HashMap<_, _>>::default();
c.insert(0usize, 3.21_f64);
let a: &dyn PartialReflect = &a;
let b: &dyn PartialReflect = &b;
let c: &dyn PartialReflect = &c;
assert!(a.reflect_partial_eq(b).unwrap_or_default());
assert!(!a.reflect_partial_eq(c).unwrap_or_default());
}
#[test]
fn path_should_from_reflect() {
let path = Path::new("hello_world.rs");
let output = <&'static Path as FromReflect>::from_reflect(&path).unwrap();
assert_eq!(path, output);
}
#[test]
fn type_id_should_from_reflect() {
let type_id = core::any::TypeId::of::<usize>();
let output = <core::any::TypeId as FromReflect>::from_reflect(&type_id).unwrap();
assert_eq!(type_id, output);
}
#[test]
fn static_str_should_from_reflect() {
let expected = "Hello, World!";
let output = <&'static str as FromReflect>::from_reflect(&expected).unwrap();
assert_eq!(expected, output);
}
}