MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_diff_run_with_added_file

Function test_diff_run_with_added_file

atomic-cli/src/commands/diff/tests.rs:1348–1370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1346 #[test]
1347 #[file_serial]
1348 fn test_diff_run_with_added_file() {
1349 let _guard = DirGuard::new();
1350
1351 let temp_dir = tempfile::tempdir().unwrap();
1352 let repo_path = temp_dir.path();
1353
1354 // Initialize repository, create and add a file
1355 {
1356 let repo = Repository::init(repo_path).unwrap();
1357 std::fs::write(repo_path.join("new_file.txt"), "New content").unwrap();
1358 let working_copy = repo.require_working_copy_id().unwrap();
1359 repo.add(working_copy, "new_file.txt", Default::default())
1360 .unwrap();
1361 }
1362
1363 std::env::set_current_dir(repo_path).unwrap();
1364
1365 let diff = Diff::new();
1366 let result = diff.run();
1367
1368 // Should succeed and show the added file
1369 assert!(result.is_ok());
1370 }
1371
1372 #[test]
1373 #[file_serial]

Callers

nothing calls this directly

Calls 7

initFunction · 0.50
writeFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected