(t *testing.T)
| 209 | } |
| 210 | |
| 211 | func TestPatchSplitMax(t *testing.T) { |
| 212 | type TestCase struct { |
| 213 | Text1 string |
| 214 | Text2 string |
| 215 | |
| 216 | Expected string |
| 217 | } |
| 218 | |
| 219 | dmp := New() |
| 220 | |
| 221 | for i, tc := range []TestCase{ |
| 222 | {"abcdefghijklmnopqrstuvwxyz01234567890", "XabXcdXefXghXijXklXmnXopXqrXstXuvXwxXyzX01X23X45X67X89X0", "@@ -1,32 +1,46 @@\n+X\n ab\n+X\n cd\n+X\n ef\n+X\n gh\n+X\n ij\n+X\n kl\n+X\n mn\n+X\n op\n+X\n qr\n+X\n st\n+X\n uv\n+X\n wx\n+X\n yz\n+X\n 012345\n@@ -25,13 +39,18 @@\n zX01\n+X\n 23\n+X\n 45\n+X\n 67\n+X\n 89\n+X\n 0\n"}, |
| 223 | {"abcdef1234567890123456789012345678901234567890123456789012345678901234567890uvwxyz", "abcdefuvwxyz", "@@ -3,78 +3,8 @@\n cdef\n-1234567890123456789012345678901234567890123456789012345678901234567890\n uvwx\n"}, |
| 224 | {"1234567890123456789012345678901234567890123456789012345678901234567890", "abc", "@@ -1,32 +1,4 @@\n-1234567890123456789012345678\n 9012\n@@ -29,32 +1,4 @@\n-9012345678901234567890123456\n 7890\n@@ -57,14 +1,3 @@\n-78901234567890\n+abc\n"}, |
| 225 | {"abcdefghij , h : 0 , t : 1 abcdefghij , h : 0 , t : 1 abcdefghij , h : 0 , t : 1", "abcdefghij , h : 1 , t : 1 abcdefghij , h : 1 , t : 1 abcdefghij , h : 0 , t : 1", "@@ -2,32 +2,32 @@\n bcdefghij , h : \n-0\n+1\n , t : 1 abcdef\n@@ -29,32 +29,32 @@\n bcdefghij , h : \n-0\n+1\n , t : 1 abcdef\n"}, |
| 226 | } { |
| 227 | patches := dmp.PatchMake(tc.Text1, tc.Text2) |
| 228 | patches = dmp.PatchSplitMax(patches) |
| 229 | |
| 230 | actual := dmp.PatchToText(patches) |
| 231 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc)) |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | func TestPatchAddPadding(t *testing.T) { |
| 236 | type TestCase struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…