MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_list_after_switch

Function test_list_after_switch

atomic-cli/src/commands/view/list.rs:308–333  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

306 #[test]
307 #[serial]
308 fn test_list_after_switch() {
309 use tempfile::tempdir;
310
311 let _guard = DirGuard::new();
312 let temp = tempdir().unwrap();
313 let repo_path = temp.path();
314
315 // Initialize a repository and create a view, then drop to release lock
316 {
317 let mut repo = Repository::init(repo_path).unwrap();
318 repo.create_view("feature").unwrap();
319 repo.align_to_view("feature").unwrap();
320 }
321
322 // Change to the repo directory
323 std::env::set_current_dir(repo_path).unwrap();
324
325 // List views - should mark "feature" as current
326 let cmd = List::new();
327 let result = cmd.run();
328 assert!(result.is_ok());
329
330 // Verify we're still on feature
331 let repo = Repository::open(repo_path).unwrap();
332 assert_eq!(repo.current_view(), "feature");
333 }
334}

Callers

nothing calls this directly

Calls 5

align_to_viewMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
create_viewMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected