MCPcopy Create free account
hub / github.com/antonmedv/gitmal / TestApplyBinaryFragment

Function TestApplyBinaryFragment

pkg/gitdiff/apply_test.go:79–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestApplyBinaryFragment(t *testing.T) {
80 tests := map[string]applyTest{
81 "literalCreate": {Files: getApplyFiles("bin_fragment_literal_create")},
82 "literalModify": {Files: getApplyFiles("bin_fragment_literal_modify")},
83 "deltaModify": {Files: getApplyFiles("bin_fragment_delta_modify")},
84 "deltaModifyLarge": {Files: getApplyFiles("bin_fragment_delta_modify_large")},
85
86 "errorIncompleteAdd": {
87 Files: applyFiles{
88 Src: "bin_fragment_delta_error.src",
89 Patch: "bin_fragment_delta_error_incomplete_add.patch",
90 },
91 Err: "incomplete add",
92 },
93 "errorIncompleteCopy": {
94 Files: applyFiles{
95 Src: "bin_fragment_delta_error.src",
96 Patch: "bin_fragment_delta_error_incomplete_copy.patch",
97 },
98 Err: "incomplete copy",
99 },
100 "errorSrcSize": {
101 Files: applyFiles{
102 Src: "bin_fragment_delta_error.src",
103 Patch: "bin_fragment_delta_error_src_size.patch",
104 },
105 Err: &Conflict{},
106 },
107 "errorDstSize": {
108 Files: applyFiles{
109 Src: "bin_fragment_delta_error.src",
110 Patch: "bin_fragment_delta_error_dst_size.patch",
111 },
112 Err: "insufficient or extra data",
113 },
114 }
115
116 for name, test := range tests {
117 t.Run(name, func(t *testing.T) {
118 test.run(t, func(dst io.Writer, src io.ReaderAt, file *File) error {
119 applier := NewBinaryApplier(dst, src)
120 return applier.ApplyFragment(file.BinaryFragment)
121 })
122 })
123 }
124}
125
126func TestApplyFile(t *testing.T) {
127 tests := map[string]applyTest{

Callers

nothing calls this directly

Calls 4

ApplyFragmentMethod · 0.95
getApplyFilesFunction · 0.85
NewBinaryApplierFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected