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

Function TestApplyFile

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

Source from the content-addressed store, hash-verified

124}
125
126func TestApplyFile(t *testing.T) {
127 tests := map[string]applyTest{
128 "textModify": {
129 Files: applyFiles{
130 Src: "file_text.src",
131 Patch: "file_text_modify.patch",
132 Out: "file_text_modify.out",
133 },
134 },
135 "textDelete": {
136 Files: applyFiles{
137 Src: "file_text.src",
138 Patch: "file_text_delete.patch",
139 Out: "file_text_delete.out",
140 },
141 },
142 "textErrorPartialDelete": {
143 Files: applyFiles{
144 Src: "file_text.src",
145 Patch: "file_text_error_partial_delete.patch",
146 },
147 Err: &Conflict{},
148 },
149 "binaryModify": {
150 Files: getApplyFiles("file_bin_modify"),
151 },
152 "modeChange": {
153 Files: getApplyFiles("file_mode_change"),
154 },
155 }
156
157 for name, test := range tests {
158 t.Run(name, func(t *testing.T) {
159 test.run(t, func(dst io.Writer, src io.ReaderAt, file *File) error {
160 return Apply(dst, src, file)
161 })
162 })
163 }
164}
165
166type applyTest struct {
167 Files applyFiles

Callers

nothing calls this directly

Calls 3

getApplyFilesFunction · 0.85
ApplyFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected