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

Function test_add_run_directory

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

Source from the content-addressed store, hash-verified

1001 #[test]
1002 #[file_serial]
1003 fn test_add_run_directory() {
1004 let _guard = DirGuard::new();
1005
1006 let temp_dir = tempfile::tempdir().unwrap();
1007 let repo_path = temp_dir.path();
1008
1009 // Initialize repository
1010 {
1011 let _repo = Repository::init(repo_path).unwrap();
1012 }
1013
1014 // Create directory with files
1015 let src_dir = repo_path.join("src");
1016 std::fs::create_dir(&src_dir).unwrap();
1017 std::fs::write(src_dir.join("main.rs"), "fn main() {}").unwrap();
1018 std::fs::write(src_dir.join("lib.rs"), "// lib").unwrap();
1019
1020 std::env::set_current_dir(repo_path).unwrap();
1021
1022 let add = Add::new().with_files(vec!["src"]);
1023 let result = add.run();
1024
1025 assert!(result.is_ok(), "Add failed: {:?}", result.err());
1026 }
1027
1028 #[test]
1029 #[file_serial]

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected