Skip to main content

whitaker_common/attributes/
path.rs

1//! Attribute-specific conveniences built atop the shared path helper.
2
3use crate::path::SimplePath;
4
5/// Structured representation of an attribute path such as `tokio::test`.
6pub type AttributePath = SimplePath;
7
8#[cfg(test)]
9mod tests {
10    use super::AttributePath;
11    use rstest::rstest;
12
13    #[rstest]
14    fn parses_paths() {
15        let path = AttributePath::from("tokio::test");
16        assert_eq!(path.segments(), &["tokio", "test"]);
17    }
18
19    #[rstest]
20    fn recognizes_doc_paths() {
21        assert!(AttributePath::from("doc").is_doc());
22        assert!(!AttributePath::from("allow").is_doc());
23    }
24}