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

Function test_update_trunk_path

atomic-core/src/crdt/apply/traits.rs:739–754  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

737
738 #[test]
739 fn test_update_trunk_path() {
740 let mut txn = MockCrdtTxn::new();
741 let id = TrunkId::new(NodeId::new(1), 0);
742 let trunk = Trunk::new(id, Inode::new(1), "old.rs".to_string(), None);
743
744 txn.put_trunk(&trunk).unwrap();
745 txn.update_trunk_path(id, "new.rs").unwrap();
746
747 let retrieved = txn.get_trunk(id).unwrap().unwrap();
748 assert_eq!(retrieved.path(), "new.rs");
749
750 // Old path should not work
751 assert!(txn.get_trunk_by_path("old.rs").unwrap().is_none());
752 // New path should work
753 assert_eq!(txn.get_trunk_by_path("new.rs").unwrap(), Some(id));
754 }
755
756 // Branch Tests
757

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.45
put_trunkMethod · 0.45
update_trunk_pathMethod · 0.45
get_trunkMethod · 0.45

Tested by

no test coverage detected