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

Source from the content-addressed store, hash-verified

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

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