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

Function test_add_run_dry_run

atomic-cli/src/commands/add.rs:882–908  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

880 #[test]
881 #[serial]
882 fn test_add_run_dry_run() {
883 let _guard = DirGuard::new();
884
885 let temp_dir = tempfile::tempdir().unwrap();
886 let repo_path = temp_dir.path();
887
888 // Initialize repository
889 {
890 let _repo = Repository::init(repo_path).unwrap();
891 }
892
893 // Create a file
894 std::fs::write(repo_path.join("test.txt"), "Hello").unwrap();
895
896 std::env::set_current_dir(repo_path).unwrap();
897
898 let add = Add::new().with_files(vec!["test.txt"]).with_dry_run(true);
899 let result = add.run();
900
901 assert!(result.is_ok(), "Dry run failed: {:?}", result.err());
902
903 // Verify file was not actually tracked
904 {
905 let repo = Repository::open(repo_path).unwrap();
906 assert!(!repo.is_tracked("test.txt").unwrap_or(true));
907 }
908 }
909
910 #[test]
911 #[serial]

Callers

nothing calls this directly

Calls 6

writeFunction · 0.85
unwrapMethod · 0.45
pathMethod · 0.45
with_dry_runMethod · 0.45
with_filesMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected