mirror of
https://github.com/PR0M3TH3AN/Marlin.git
synced 2025-09-09 07:38:50 +00:00
updates
This commit is contained in:
22
libmarlin/src/config_tests.rs
Normal file
22
libmarlin/src/config_tests.rs
Normal 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"));
|
||||
}
|
Reference in New Issue
Block a user