(t *testing.T)
| 50 | "line10" |
| 51 | |
| 52 | func TestPrintDiffWithContext(t *testing.T) { |
| 53 | t.Run("context-disabled", func(t *testing.T) { |
| 54 | assertDiff(t, text1, text2, -1, false, ""+ |
| 55 | "- line1\n"+ |
| 56 | "- line2\n"+ |
| 57 | "+ line1 - different!\n"+ |
| 58 | "+ line2 - different!\n"+ |
| 59 | " line3\n"+ |
| 60 | " line4\n"+ |
| 61 | " line5\n"+ |
| 62 | " line6\n"+ |
| 63 | " line7\n"+ |
| 64 | "- line8\n"+ |
| 65 | "+ line8 - different!\n"+ |
| 66 | " line9\n"+ |
| 67 | " line10\n") |
| 68 | }) |
| 69 | |
| 70 | t.Run("context-0", func(t *testing.T) { |
| 71 | assertDiff(t, text1, text2, 0, false, ""+ |
| 72 | "- line1\n"+ |
| 73 | "- line2\n"+ |
| 74 | "+ line1 - different!\n"+ |
| 75 | "+ line2 - different!\n"+ |
| 76 | "...\n"+ |
| 77 | "- line8\n"+ |
| 78 | "+ line8 - different!\n"+ |
| 79 | "...\n") |
| 80 | }) |
| 81 | |
| 82 | t.Run("context-0-no-strip-cr", func(t *testing.T) { |
| 83 | assertDiff(t, text1, text3, 0, false, ""+ |
| 84 | "- line1\n"+ |
| 85 | "- line2\n"+ |
| 86 | "- line3\n"+ |
| 87 | "- line4\n"+ |
| 88 | "- line5\n"+ |
| 89 | "- line6\n"+ |
| 90 | "- line7\n"+ |
| 91 | "- line8\n"+ |
| 92 | "- line9\n"+ |
| 93 | "+ line1\r\n"+ |
| 94 | "+ line2\r\n"+ |
| 95 | "+ line3\r\n"+ |
| 96 | "+ line4\r\n"+ |
| 97 | "+ line5\r\n"+ |
| 98 | "+ line6\r\n"+ |
| 99 | "+ line7\r\n"+ |
| 100 | "+ line8\r\n"+ |
| 101 | "+ line9\r\n"+ |
| 102 | "...\n") |
| 103 | }) |
| 104 | |
| 105 | t.Run("context-0-strip-cr", func(t *testing.T) { |
| 106 | assertDiff(t, text1, text3, 0, true, ""+ |
| 107 | "...\n") |
| 108 | }) |
| 109 |
nothing calls this directly
no test coverage detected