97001e1544
Move all 29 workspace members from packages/<name>/ to crates/<name>/. Updates: workspace Cargo.toml (members + path deps), justfile, root CLAUDE.md, scripts/build/CARGO_INSTALL.md, docs/architecture/crates.md (renamed from packages.md), structural references in docs/architecture and docs/configuration, per-crate CLAUDE.md self-references. Historical plans, reports, and building/ docs are left untouched. No behavior change; just check-all stays green and fermata tests pass.
48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
use dirigent_fermata::core::toml_config::{BotignoreToml, OpRules, BashRules};
|
|
|
|
#[test]
|
|
fn parses_full_config() {
|
|
let src = r#"
|
|
[read]
|
|
patterns = [".env*", "secrets/**"]
|
|
|
|
[write]
|
|
patterns = ["vendor/**", "*.lock"]
|
|
|
|
[bash]
|
|
deny = ["rm -rf /", "git push --force*"]
|
|
ask = ["rm:*"]
|
|
allow_prefixes = ["make test", "git checkout:*"]
|
|
"#;
|
|
let cfg: BotignoreToml = toml::from_str(src).unwrap();
|
|
assert_eq!(cfg.read.unwrap().patterns, vec![".env*", "secrets/**"]);
|
|
assert_eq!(cfg.write.unwrap().patterns, vec!["vendor/**", "*.lock"]);
|
|
let bash = cfg.bash.unwrap();
|
|
assert_eq!(bash.deny, vec!["rm -rf /", "git push --force*"]);
|
|
assert_eq!(bash.ask, vec!["rm:*"]);
|
|
assert_eq!(bash.allow_prefixes, vec!["make test", "git checkout:*"]);
|
|
}
|
|
|
|
#[test]
|
|
fn empty_config_is_valid() {
|
|
let cfg: BotignoreToml = toml::from_str("").unwrap();
|
|
assert!(cfg.read.is_none());
|
|
assert!(cfg.write.is_none());
|
|
assert!(cfg.bash.is_none());
|
|
}
|
|
|
|
#[test]
|
|
fn loads_from_disk_when_present() {
|
|
let tmp = tempfile::tempdir().unwrap();
|
|
std::fs::write(tmp.path().join("botignore.toml"), "[read]\npatterns = [\".env\"]\n").unwrap();
|
|
let cfg = BotignoreToml::load(tmp.path()).unwrap();
|
|
assert_eq!(cfg.read.unwrap().patterns, vec![".env"]);
|
|
}
|
|
|
|
#[test]
|
|
fn loads_empty_when_missing() {
|
|
let tmp = tempfile::tempdir().unwrap();
|
|
let cfg = BotignoreToml::load(tmp.path()).unwrap();
|
|
assert!(cfg.read.is_none());
|
|
}
|