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

Source from the content-addressed store, hash-verified

468 #[test]
469 #[serial]
470 fn test_list_after_switch() {
471 use tempfile::tempdir;
472
473 let _guard = DirGuard::new();
474 let temp = tempdir().unwrap();
475 let repo_path = temp.path();
476
477 // Initialize a repository and create a view, then drop to release lock
478 {
479 let mut repo = Repository::init(repo_path).unwrap();
480 repo.create_view("feature").unwrap();
481 repo.align_to_view("feature").unwrap();
482 }
483
484 // Change to the repo directory
485 std::env::set_current_dir(repo_path).unwrap();
486
487 // List views - should mark "feature" as current
488 let cmd = List::new();
489 let result = cmd.run();
490 assert!(result.is_ok());
491
492 // Verify we're still on feature
493 let repo = Repository::open(repo_path).unwrap();
494 assert_eq!(repo.current_view(), "feature");
495 }
496}

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