()
| 1003 | |
| 1004 | #[test] |
| 1005 | fn test_validate_branch_parent() { |
| 1006 | let mut txn = MockTxn::new(); |
| 1007 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 1008 | let trunk_id = create_test_trunk(&mut txn, 1); |
| 1009 | let branch_id = BranchId::new(NodeId::new(1), 0); |
| 1010 | |
| 1011 | // Create a branch |
| 1012 | let insert_op = BranchOp::Insert { |
| 1013 | after: None, |
| 1014 | content: vec![], |
| 1015 | }; |
| 1016 | apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &insert_op, &[]).unwrap(); |
| 1017 | |
| 1018 | // Should pass for correct trunk |
| 1019 | validate_branch_parent(&txn, branch_id, trunk_id).unwrap(); |
| 1020 | |
| 1021 | // Should fail for wrong trunk |
| 1022 | let wrong_trunk = TrunkId::new(NodeId::new(99), 0); |
| 1023 | let result = validate_branch_parent(&txn, branch_id, wrong_trunk); |
| 1024 | assert!(result.is_err()); |
| 1025 | } |
| 1026 | } |
nothing calls this directly
no test coverage detected