(t *testing.T)
| 303 | } |
| 304 | |
| 305 | func TestOutputFormatRangeFormatContext(t *testing.T) { |
| 306 | // Per the diff spec at http://www.unix.org/single_unix_specification/ |
| 307 | // |
| 308 | // The range of lines in file1 shall be written in the following format |
| 309 | // if the range contains two or more lines: |
| 310 | // "*** %d,%d ****\n", <beginning line number>, <ending line number> |
| 311 | // and the following format otherwise: |
| 312 | // "*** %d ****\n", <ending line number> |
| 313 | // The ending line number of an empty range shall be the number of the preceding line, |
| 314 | // or 0 if the range is at the start of the file. |
| 315 | // |
| 316 | // Next, the range of lines in file2 shall be written in the following format |
| 317 | // if the range contains two or more lines: |
| 318 | // "--- %d,%d ----\n", <beginning line number>, <ending line number> |
| 319 | // and the following format otherwise: |
| 320 | // "--- %d ----\n", <ending line number> |
| 321 | fm := formatRangeContext |
| 322 | assertEqual(t, fm(3, 3), "3") |
| 323 | assertEqual(t, fm(3, 4), "4") |
| 324 | assertEqual(t, fm(3, 5), "4,5") |
| 325 | assertEqual(t, fm(3, 6), "4,6") |
| 326 | assertEqual(t, fm(0, 0), "0") |
| 327 | } |
| 328 | |
| 329 | func TestOutputFormatTabDelimiter(t *testing.T) { |
| 330 | diff := LineDiffParams{ |
nothing calls this directly
no test coverage detected