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

Function test_status_in_subdirectory

atomic-cli/src/commands/status.rs:1156–1188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1154 #[test]
1155 #[serial]
1156 fn test_status_in_subdirectory() {
1157 let _guard = DirGuard::new();
1158
1159 let temp_dir = tempfile::tempdir().unwrap();
1160 let repo_path = temp_dir.path();
1161
1162 // Initialize a repository and drop handle to release lock
1163 {
1164 let repo_result = Repository::init(repo_path);
1165 assert!(
1166 repo_result.is_ok(),
1167 "Failed to init repository: {:?}",
1168 repo_result.err()
1169 );
1170 }
1171
1172 // Create subdirectory
1173 let subdir = repo_path.join("subdir");
1174 std::fs::create_dir(&subdir).unwrap();
1175
1176 // Change to subdirectory
1177 std::env::set_current_dir(&subdir).unwrap();
1178
1179 let status = Status::new();
1180 let result = status.run();
1181
1182 // Should find repo by walking up to parent
1183 assert!(
1184 result.is_ok(),
1185 "Status in subdirectory failed: {:?}",
1186 result.err()
1187 );
1188 }
1189
1190 #[test]
1191 #[serial]

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected