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

Source from the content-addressed store, hash-verified

317 #[test]
318 #[serial]
319 fn test_switch_to_current_view() {
320 use tempfile::tempdir;
321
322 let _guard = DirGuard::new();
323 let temp = tempdir().unwrap();
324 let repo_path = temp.path();
325
326 // Initialize a repository (default view is "dev") and drop to release lock
327 {
328 let _repo = Repository::init(repo_path).unwrap();
329 }
330
331 // Change to the repo directory
332 std::env::set_current_dir(repo_path).unwrap();
333
334 // Switch to the current view (should succeed with a message)
335 let cmd = Switch::with_name("dev");
336 let result = cmd.run();
337 assert!(result.is_ok());
338
339 // Verify we're still on dev
340 let repo = Repository::open(repo_path).unwrap();
341 assert_eq!(repo.current_view(), "dev");
342 }
343}

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected