use miniconf::{Leaf, Metadata, Node, Path, Traversal, Tree, TreeKey}; #[derive(Default)] pub struct SkippedType; #[derive(Tree, Default)] struct Settings { #[tree(skip)] _long_skipped_type: SkippedType, value: Leaf, } #[test] fn meta() { let meta = Settings::traverse_all::().unwrap(); assert_eq!(meta.max_depth, 1); assert_eq!(meta.max_length("/"), "/value".len()); assert_eq!(meta.count.get(), 1); } #[test] fn path() { assert_eq!( Settings::transcode::, _>([0usize]), Ok((Path("/value".to_owned()), Node::leaf(1))) ); assert_eq!( Settings::transcode::, _>([1usize]), Err(Traversal::NotFound(1)) ); } #[test] fn skip_struct() { #[allow(dead_code)] #[derive(Tree)] #[tree(flatten)] pub struct S(Leaf, #[tree(skip)] i32); }