(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func 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 | |
| 166 | type applyTest struct { |
| 167 | Files applyFiles |
nothing calls this directly
no test coverage detected