(t *testing.T)
| 239 | } |
| 240 | |
| 241 | func TestPatchAddPadding(t *testing.T) { |
| 242 | type TestCase struct { |
| 243 | Name string |
| 244 | |
| 245 | Text1 string |
| 246 | Text2 string |
| 247 | |
| 248 | Expected string |
| 249 | ExpectedWithPadding string |
| 250 | } |
| 251 | |
| 252 | dmp := New() |
| 253 | |
| 254 | for i, tc := range []TestCase{ |
| 255 | {"Both edges full", "", "test", "@@ -0,0 +1,4 @@\n+test\n", "@@ -1,8 +1,12 @@\n %01%02%03%04\n+test\n %01%02%03%04\n"}, |
| 256 | {"Both edges partial", "XY", "XtestY", "@@ -1,2 +1,6 @@\n X\n+test\n Y\n", "@@ -2,8 +2,12 @@\n %02%03%04X\n+test\n Y%01%02%03\n"}, |
| 257 | {"Both edges none", "XXXXYYYY", "XXXXtestYYYY", "@@ -1,8 +1,12 @@\n XXXX\n+test\n YYYY\n", "@@ -5,8 +5,12 @@\n XXXX\n+test\n YYYY\n"}, |
| 258 | } { |
| 259 | patches := dmp.PatchMake(tc.Text1, tc.Text2) |
| 260 | |
| 261 | actual := dmp.PatchToText(patches) |
| 262 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 263 | |
| 264 | dmp.PatchAddPadding(patches) |
| 265 | |
| 266 | actualWithPadding := dmp.PatchToText(patches) |
| 267 | assert.Equal(t, tc.ExpectedWithPadding, actualWithPadding, fmt.Sprintf("Test case #%d, %s", i, tc.Name)) |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | func TestPatchApply(t *testing.T) { |
| 272 | type TestCase struct { |
nothing calls this directly
no test coverage detected