(t *testing.T)
| 293 | } |
| 294 | |
| 295 | func TestOutputFormatRangeFormatContext(t *testing.T) { |
| 296 | // Per the diff spec at http://www.unix.org/single_unix_specification/ |
| 297 | // |
| 298 | // The range of lines in file1 shall be written in the following format |
| 299 | // if the range contains two or more lines: |
| 300 | // "*** %d,%d ****\n", <beginning line number>, <ending line number> |
| 301 | // and the following format otherwise: |
| 302 | // "*** %d ****\n", <ending line number> |
| 303 | // The ending line number of an empty range shall be the number of the preceding line, |
| 304 | // or 0 if the range is at the start of the file. |
| 305 | // |
| 306 | // Next, the range of lines in file2 shall be written in the following format |
| 307 | // if the range contains two or more lines: |
| 308 | // "--- %d,%d ----\n", <beginning line number>, <ending line number> |
| 309 | // and the following format otherwise: |
| 310 | // "--- %d ----\n", <ending line number> |
| 311 | fm := formatRangeContext |
| 312 | assertEqual(t, fm(3, 3), "3") |
| 313 | assertEqual(t, fm(3, 4), "4") |
| 314 | assertEqual(t, fm(3, 5), "4,5") |
| 315 | assertEqual(t, fm(3, 6), "4,6") |
| 316 | assertEqual(t, fm(0, 0), "0") |
| 317 | } |
| 318 | |
| 319 | func TestOutputFormatTabDelimiter(t *testing.T) { |
| 320 | diff := UnifiedDiff{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…