| 2300 | |
| 2301 | #[test] |
| 2302 | fn test_init_does_not_overwrite_without_force() { |
| 2303 | let temp_dir = TempDir::new().unwrap(); |
| 2304 | let agents_dir = temp_dir.path().join(".agents"); |
| 2305 | fs::create_dir_all(&agents_dir).unwrap(); |
| 2306 | |
| 2307 | // Create existing files with custom content |
| 2308 | let config_path = agents_dir.join("agentsync.toml"); |
| 2309 | let original_config = "# My custom config"; |
| 2310 | fs::write(&config_path, original_config).unwrap(); |
| 2311 | |
| 2312 | let agents_md_path = agents_dir.join("AGENTS.md"); |
| 2313 | let original_agents = "# My custom agents"; |
| 2314 | fs::write(&agents_md_path, original_agents).unwrap(); |
| 2315 | |
| 2316 | // Init without force |
| 2317 | init(temp_dir.path(), false).unwrap(); |
| 2318 | |
| 2319 | // Files should NOT be overwritten |
| 2320 | assert_eq!(fs::read_to_string(&config_path).unwrap(), original_config); |
| 2321 | assert_eq!( |
| 2322 | fs::read_to_string(&agents_md_path).unwrap(), |
| 2323 | original_agents |
| 2324 | ); |
| 2325 | } |
| 2326 | |
| 2327 | #[test] |
| 2328 | fn test_init_overwrites_with_force() { |