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

Source from the content-addressed store, hash-verified

320 #[test]
321 #[serial]
322 fn test_list_after_switch() {
323 use tempfile::tempdir;
324
325 let _guard = DirGuard::new();
326 let temp = tempdir().unwrap();
327 let repo_path = temp.path();
328
329 // Initialize a repository and create a view, then drop to release lock
330 {
331 let mut repo = Repository::init(repo_path).unwrap();
332 repo.create_view("feature").unwrap();
333 repo.align_to_view("feature").unwrap();
334 }
335
336 // Change to the repo directory
337 std::env::set_current_dir(repo_path).unwrap();
338
339 // List views - should mark "feature" as current
340 let cmd = List::new();
341 let result = cmd.run();
342 assert!(result.is_ok());
343
344 // Verify we're still on feature
345 let repo = Repository::open(repo_path).unwrap();
346 assert_eq!(repo.current_view(), "feature");
347 }
348}

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