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

Source from the content-addressed store, hash-verified

1106 #[test]
1107 #[serial]
1108 fn test_list_after_switch() {
1109 use tempfile::tempdir;
1110
1111 let _guard = DirGuard::new();
1112 let temp = tempdir().unwrap();
1113 let repo_path = temp.path();
1114
1115 // Initialize a repository and create a view, then drop to release lock
1116 {
1117 let mut repo = Repository::init(repo_path).unwrap();
1118 repo.create_view("feature").unwrap();
1119 repo.align_to_view("feature").unwrap();
1120 }
1121
1122 // Change to the repo directory
1123 std::env::set_current_dir(repo_path).unwrap();
1124
1125 // List views - should mark "feature" as current
1126 let cmd = List::new();
1127 let result = cmd.run();
1128 assert!(result.is_ok());
1129
1130 // Verify we're still on feature
1131 let repo = Repository::open(repo_path).unwrap();
1132 assert_eq!(repo.current_view(), "feature");
1133 }
1134}

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