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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected