refactor: move inline tests to separate files via #[path]
This commit is contained in:
@@ -78,21 +78,5 @@ impl Config {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn config_roundtrip() {
|
||||
let config = Config {
|
||||
api_url: "http://localhost:3000".into(),
|
||||
};
|
||||
let json = serde_json::to_string(&config).unwrap();
|
||||
let decoded: Config = serde_json::from_str(&json).unwrap();
|
||||
assert_eq!(decoded.api_url, "http://localhost:3000");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn load_returns_none_when_no_file() {
|
||||
let _ = Config::load();
|
||||
}
|
||||
}
|
||||
#[path = "tests/config.rs"]
|
||||
mod tests;
|
||||
|
||||
Reference in New Issue
Block a user