diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-07 04:03:34 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-07 04:03:34 +0100 |
| commit | 7cc5fe5cd008072b99fc470b0ed730f7fa4e2881 (patch) | |
| tree | 5ae0e65497528342d3b21dd343ace364a61fb82c /common/object/src/tests.rs | |
| parent | f932d4de439c6472d34ed4bbf530fca13b84d73a (diff) | |
| download | jellything-7cc5fe5cd008072b99fc470b0ed730f7fa4e2881.tar jellything-7cc5fe5cd008072b99fc470b0ed730f7fa4e2881.tar.bz2 jellything-7cc5fe5cd008072b99fc470b0ed730f7fa4e2881.tar.zst | |
debug inpect impl
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!() +} |