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

Function test_writer_full_conflict_sequence

atomic-core/src/output/traits.rs:1049–1088  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1047
1048 #[test]
1049 fn test_writer_full_conflict_sequence() {
1050 let buf: Vec<u8> = Vec::new();
1051 let mut writer = Writer::new(buf);
1052
1053 // Simulate a full conflict
1054 writer.begin_conflict(1, None).unwrap();
1055
1056 // First side content
1057 let v1 = GraphNode {
1058 change: NodeId::new(1),
1059 start: ChangePosition::new(0),
1060 end: ChangePosition::new(7),
1061 };
1062 let _: Result<(), std::io::Error> = writer.output_line(v1, |buf| {
1063 buf.copy_from_slice(b"side 1\n");
1064 Ok(())
1065 });
1066
1067 writer.conflict_next(1, None).unwrap();
1068
1069 // Second side content
1070 let v2 = GraphNode {
1071 change: NodeId::new(2),
1072 start: ChangePosition::new(0),
1073 end: ChangePosition::new(7),
1074 };
1075 let _: Result<(), std::io::Error> = writer.output_line(v2, |buf| {
1076 buf.copy_from_slice(b"side 2\n");
1077 Ok(())
1078 });
1079
1080 writer.end_conflict(1).unwrap();
1081
1082 let output = String::from_utf8(writer.into_inner()).unwrap();
1083 assert!(output.contains(markers::START));
1084 assert!(output.contains("side 1"));
1085 assert!(output.contains(markers::SEPARATOR));
1086 assert!(output.contains("side 2"));
1087 assert!(output.contains(markers::END));
1088 }
1089
1090 #[test]
1091 fn test_writer_marker_after_no_newline() {

Callers

nothing calls this directly

Calls 6

unwrapMethod · 0.45
begin_conflictMethod · 0.45
output_lineMethod · 0.45
conflict_nextMethod · 0.45
end_conflictMethod · 0.45
into_innerMethod · 0.45

Tested by

no test coverage detected