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

Source from the content-addressed store, hash-verified

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