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

Source from the content-addressed store, hash-verified

263 #[test]
264 #[serial]
265 fn test_switch_to_existing_view() {
266 use tempfile::tempdir;
267
268 let _guard = DirGuard::new();
269 let temp = tempdir().unwrap();
270 let repo_path = temp.path();
271
272 // Initialize a repository and create a view, then drop to release lock
273 {
274 let mut repo = Repository::init(repo_path).unwrap();
275 repo.create_view("feature-test").unwrap();
276 }
277
278 // Change to the repo directory
279 std::env::set_current_dir(repo_path).unwrap();
280
281 // Switch to the new view
282 let cmd = Switch::with_name("feature-test");
283 let result = cmd.run();
284 assert!(result.is_ok());
285
286 // Verify we switched
287 let repo = Repository::open(repo_path).unwrap();
288 assert_eq!(repo.current_view(), "feature-test");
289 }
290
291 #[test]
292 #[serial]

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.45
pathMethod · 0.45
create_viewMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected