(t *testing.T)
| 566 | } |
| 567 | |
| 568 | func TestDifferPlainReplace(t *testing.T) { |
| 569 | diff := NewDiffer() |
| 570 | aLst := stringsToBytes("one\n", "two\n", "three\n", "four\n", "five\n") |
| 571 | bLst := stringsToBytes("one\n", "two2\n", "three\n", "extra\n") |
| 572 | // Test a then b |
| 573 | out, err := diff.PlainReplace(aLst, 1, 2, bLst, 1, 2) |
| 574 | if err != nil { |
| 575 | t.Fatal("Differ PlainReplace() error:", err) |
| 576 | } |
| 577 | out2 := bytesToStrings(out...) |
| 578 | if reflect.DeepEqual(out2, []string{"- two\n", "+ two2\n"}) != true { |
| 579 | t.Fatal("Differ PlainReplace() failure:", out2) |
| 580 | } |
| 581 | // Test b then a |
| 582 | out, err = diff.PlainReplace(aLst, 3, 5, bLst, 3, 4) |
| 583 | if err != nil { |
| 584 | t.Fatal("Differ PlainReplace() error:", err) |
| 585 | } |
| 586 | out2 = bytesToStrings(out...) |
| 587 | if reflect.DeepEqual(out2, |
| 588 | []string{"+ extra\n", "- four\n", "- five\n"}) != true { |
| 589 | t.Fatal("Differ PlainReplace() failure:", out2) |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | func TestDifferFancyReplaceAndHelper(t *testing.T) { |
| 594 | diff := NewDiffer() |
nothing calls this directly
no test coverage detected