| 24 | ) |
| 25 | |
| 26 | func TestDo(t *testing.T) { |
| 27 | testCases := []struct { |
| 28 | s1 string |
| 29 | s2 string |
| 30 | expected []diffmatchpatch.Diff |
| 31 | }{ |
| 32 | { |
| 33 | s1: "", |
| 34 | s2: "", |
| 35 | expected: []diffmatchpatch.Diff{}, |
| 36 | }, |
| 37 | { |
| 38 | s1: "", |
| 39 | s2: "foo", |
| 40 | expected: []diffmatchpatch.Diff{ |
| 41 | { |
| 42 | Type: diffmatchpatch.DiffInsert, |
| 43 | Text: "foo", |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | { |
| 48 | s1: "foo", |
| 49 | s2: "", |
| 50 | expected: []diffmatchpatch.Diff{ |
| 51 | { |
| 52 | Type: DiffDelete, |
| 53 | Text: "foo", |
| 54 | }, |
| 55 | }, |
| 56 | }, |
| 57 | { |
| 58 | s1: "foo", |
| 59 | s2: "bar", |
| 60 | expected: []diffmatchpatch.Diff{ |
| 61 | { |
| 62 | Type: DiffDelete, |
| 63 | Text: "foo", |
| 64 | }, |
| 65 | { |
| 66 | Type: DiffInsert, |
| 67 | Text: "bar", |
| 68 | }, |
| 69 | }, |
| 70 | }, |
| 71 | { |
| 72 | s1: "foo\nbar\nbaz", |
| 73 | s2: "foo\nbar\nquz", |
| 74 | expected: []diffmatchpatch.Diff{ |
| 75 | { |
| 76 | Type: DiffEqual, |
| 77 | Text: "foo\nbar\n", |
| 78 | }, |
| 79 | { |
| 80 | Type: DiffDelete, |
| 81 | Text: "baz", |
| 82 | }, |
| 83 | { |