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

Function test_switch_to_existing_view

atomic-cli/src/commands/view/switch.rs:270–294  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268 #[test]
269 #[serial]
270 fn test_switch_to_existing_view() {
271 use tempfile::tempdir;
272
273 let _guard = DirGuard::new();
274 let temp = tempdir().unwrap();
275 let repo_path = temp.path();
276
277 // Initialize a repository and create a view, then drop to release lock
278 {
279 let mut repo = Repository::init(repo_path).unwrap();
280 repo.create_view("feature-test").unwrap();
281 }
282
283 // Change to the repo directory
284 std::env::set_current_dir(repo_path).unwrap();
285
286 // Switch to the new view
287 let cmd = Switch::with_name("feature-test");
288 let result = cmd.run();
289 assert!(result.is_ok());
290
291 // Verify we switched
292 let repo = Repository::open(repo_path).unwrap();
293 assert_eq!(repo.current_view(), "feature-test");
294 }
295
296 #[test]
297 #[serial]

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.45
pathMethod · 0.45
create_viewMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected