| 1011 | |
| 1012 | #[test] |
| 1013 | fn test_remote_config_save_and_load() { |
| 1014 | let dir = tempdir().unwrap(); |
| 1015 | let path = dir.path().join("config.toml"); |
| 1016 | |
| 1017 | let mut config = RemoteConfig::new(); |
| 1018 | config |
| 1019 | .add( |
| 1020 | "origin", |
| 1021 | RemoteEntry::new_default("https://origin.com/repo"), |
| 1022 | ) |
| 1023 | .unwrap(); |
| 1024 | config |
| 1025 | .add("upstream", RemoteEntry::new("https://upstream.com/repo")) |
| 1026 | .unwrap(); |
| 1027 | |
| 1028 | config.save(&path).unwrap(); |
| 1029 | |
| 1030 | let loaded = RemoteConfig::load(&path).unwrap(); |
| 1031 | assert_eq!(loaded.len(), 2); |
| 1032 | assert!(loaded.get("origin").unwrap().default); |
| 1033 | assert!(!loaded.get("upstream").unwrap().default); |
| 1034 | } |
| 1035 | |
| 1036 | #[test] |
| 1037 | fn test_remote_config_save_preserves_other_sections() { |