diff options
Diffstat (limited to 'common/object/src/tests.rs')
| -rw-r--r-- | common/object/src/tests.rs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/common/object/src/tests.rs b/common/object/src/tests.rs index 181b46f..86c0287 100644 --- a/common/object/src/tests.rs +++ b/common/object/src/tests.rs @@ -3,12 +3,20 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin <metamuffin.org> */ -use crate::{ObjectBuffer, Tag, TypedTag}; -use std::marker::PhantomData; -const NAME: TypedTag<&str> = TypedTag(Tag(15), PhantomData); -const AGE: TypedTag<u32> = TypedTag(Tag(13), PhantomData); -const FRIEND: TypedTag<&str> = TypedTag(Tag(54321), PhantomData); +use crate::{ObjectBuffer, Registry, fields, inspect::ObjectInpector}; +use std::sync::LazyLock; + +pub static TAGREG: LazyLock<Registry> = LazyLock::new(|| { + let mut reg = Registry::default(); + register_fields(&mut reg); + reg +}); +fields! { + NAME: &str = 15 "name"; + AGE: u32 = 13 "age"; + FRIEND: &str = 54321 "friend"; +} fn test_object() -> ObjectBuffer { ObjectBuffer::new(&mut [ @@ -59,3 +67,10 @@ fn insert() { eprintln!("{edward:#?}"); assert_eq!(edward.get(NAME), Some("Edward")); } + +#[test] +fn inspect() { + let bob = test_object(); + eprintln!("{:#?}", ObjectInpector(&TAGREG, bob.as_object())); + // panic!() +} |