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

Source from the content-addressed store, hash-verified

1199 #[test]
1200 #[file_serial]
1201 fn test_list_after_switch() {
1202 use tempfile::tempdir;
1203
1204 let _guard = DirGuard::new();
1205 let temp = tempdir().unwrap();
1206 let repo_path = temp.path();
1207
1208 // Initialize a repository and create a view, then drop to release lock
1209 {
1210 let mut repo = Repository::init(repo_path).unwrap();
1211 repo.create_view("feature").unwrap();
1212 let working_copy = repo.require_working_copy_id().unwrap();
1213 repo.align_to_view(working_copy, "feature").unwrap();
1214 }
1215
1216 // Change to the repo directory
1217 std::env::set_current_dir(repo_path).unwrap();
1218
1219 // List views - should mark "feature" as current
1220 let cmd = List::new();
1221 let result = cmd.run();
1222 assert!(result.is_ok());
1223
1224 // Verify we're still on feature
1225 let repo = Repository::open(repo_path).unwrap();
1226 assert_eq!(repo.current_view(), "feature");
1227 }
1228}

Callers

nothing calls this directly

Calls 8

openFunction · 0.85
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
create_viewMethod · 0.45
align_to_viewMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected