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

Function test_switch_to_current_view

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

Source from the content-addressed store, hash-verified

731 #[test]
732 #[file_serial]
733 fn test_switch_to_current_view() {
734 use tempfile::tempdir;
735
736 let _guard = DirGuard::new();
737 let temp = tempdir().unwrap();
738 let repo_path = temp.path();
739
740 // Initialize a repository (default view is "dev") and drop to release lock
741 {
742 let _repo = Repository::init(repo_path).unwrap();
743 }
744
745 // Change to the repo directory
746 std::env::set_current_dir(repo_path).unwrap();
747
748 // Switch to the current view (should succeed with a message)
749 let cmd = Switch::with_name("dev");
750 let result = cmd.run();
751 assert!(result.is_ok());
752
753 // Verify we're still on dev
754 let repo = Repository::open(repo_path).unwrap();
755 assert_eq!(repo.current_view(), "dev");
756 }
757}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected