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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected