This commit is contained in:
thePR0M3TH3AN
2025-05-18 21:28:05 -04:00
parent 6ddb40ca18
commit a7660df45f
16 changed files with 523 additions and 69 deletions

View File

@@ -0,0 +1,22 @@
// libmarlin/src/config_tests.rs
use super::config::Config;
use std::env;
use tempfile::tempdir;
#[test]
fn load_env_override() {
let tmp = tempdir().unwrap();
let db = tmp.path().join("custom.db");
env::set_var("MARLIN_DB_PATH", &db);
let cfg = Config::load().unwrap();
assert_eq!(cfg.db_path, db);
env::remove_var("MARLIN_DB_PATH");
}
#[test]
fn load_xdg_or_fallback() {
// since XDG_DATA_HOME will normally be present, just test it doesn't error
let cfg = Config::load().unwrap();
assert!(cfg.db_path.to_string_lossy().ends_with(".db"));
}