synapse
A component of the AienOS ecosystem.
Brought by drakestapleton
synapse / crates / synapse-crumb / tests / repo_root.rs
| 1 | //! The repository's own root `.crumb` is RFC-0001 JSON (D1), so the reference `crumb.c` |
| 2 | //! reads it too (ADR 0004 section 1.2: `crumb.c` cannot read the D3 dialect). |
| 3 | |
| 4 | use std::fs; |
| 5 | use std::path::PathBuf; |
| 6 | use synapse_crumb::{parse_crumb, Dialect, DirectoryCrumb}; |
| 7 | |
| 8 | #[test] |
| 9 | fn repository_root_crumb_is_rfc0001() { |
| 10 | let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../.crumb"); |
| 11 | let bytes = fs::read(&path).expect("repository root .crumb exists"); |
| 12 | let crumb = parse_crumb(&bytes).expect("repository root .crumb parses"); |
| 13 | assert_eq!(crumb.dialect(), Dialect::Rfc0001Json); |
| 14 | let DirectoryCrumb::Rfc0001(c) = crumb else { |
| 15 | panic!("repository root .crumb is not D1"); |
| 16 | }; |
| 17 | assert_eq!(c.name, "synapse"); |
| 18 | assert_eq!(c.layer.as_deref(), Some("root")); |
| 19 | assert!(!c.purpose.is_empty()); |
| 20 | } |