MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_workspace_parent_child

Function test_workspace_parent_child

atomic-core/src/apply/workspace.rs:1000–1016  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

998
999 #[test]
1000 fn test_workspace_parent_child() {
1001 let mut workspace = Workspace::new();
1002 let parent = Position::ROOT;
1003 let child1 = Position::new(NodeId::new(1), ChangePosition::new(0));
1004 let child2 = Position::new(NodeId::new(2), ChangePosition::new(0));
1005
1006 workspace.set_parent(child1, parent);
1007 workspace.set_parent(child2, parent);
1008
1009 assert_eq!(workspace.get_parent(&child1), Some(parent));
1010 assert_eq!(workspace.get_parent(&child2), Some(parent));
1011
1012 let children = workspace.get_children(&parent).unwrap();
1013 assert_eq!(children.len(), 2);
1014 assert!(children.contains(&child1));
1015 assert!(children.contains(&child2));
1016 }
1017
1018 #[test]
1019 fn test_workspace_no_parent() {

Callers

nothing calls this directly

Calls 3

set_parentMethod · 0.80
get_childrenMethod · 0.80
unwrapMethod · 0.45

Tested by

no test coverage detected