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:442–470  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

440 #[test]
441 #[file_serial]
442 fn test_switch_to_existing_view() {
443 use tempfile::tempdir;
444
445 let _guard = DirGuard::new();
446 let temp = tempdir().unwrap();
447 let repo_path = temp.path();
448
449 // Initialize a repository and create a view, then drop to release lock
450 {
451 let mut repo = Repository::init(repo_path).unwrap();
452 repo.create_view("feature-test").unwrap();
453 }
454
455 // Change to the repo directory
456 std::env::set_current_dir(repo_path).unwrap();
457
458 // Switch to the new view
459 let cmd = Switch::with_name("feature-test");
460 let result = cmd.run();
461 assert!(result.is_ok());
462 assert!(
463 !repo_path.join(".atomic/bridge/workspace.json").exists(),
464 "a no-Git switch must not create shim metadata"
465 );
466
467 // Verify we switched
468 let repo = Repository::open(repo_path).unwrap();
469 assert_eq!(repo.current_view(), "feature-test");
470 }
471
472 #[test]
473 #[file_serial]

Callers

nothing calls this directly

Calls 6

openFunction · 0.85
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
create_viewMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected