(t *testing.T)
| 536 | } |
| 537 | |
| 538 | func TestDifferFancyReplaceAndHelper(t *testing.T) { |
| 539 | diff := NewDiffer() |
| 540 | // Test identical sync point, both full |
| 541 | aLst := []string{"one\n", "asdf\n", "three\n"} |
| 542 | bLst := []string{"one\n", "two2\n", "three\n"} |
| 543 | out, err := diff.FancyReplace(aLst, 0, 3, bLst, 0, 3) |
| 544 | if err != nil { |
| 545 | t.Fatal("Differ FancyReplace() error:", err) |
| 546 | } |
| 547 | if reflect.DeepEqual(out, |
| 548 | []string{" one\n", "- asdf\n", "+ two2\n", " three\n"}) != true { |
| 549 | t.Fatal("Differ FancyReplace() failure:", out) |
| 550 | } |
| 551 | // Test close sync point, both full |
| 552 | aLst = []string{"one\n", "two123456\n", "asdf\n", "three\n"} |
| 553 | bLst = []string{"one\n", "two123457\n", "qwerty\n", "three\n"} |
| 554 | out, err = diff.FancyReplace(aLst, 1, 3, bLst, 1, 3) |
| 555 | if err != nil { |
| 556 | t.Fatal("Differ FancyReplace() error:", err) |
| 557 | } |
| 558 | if reflect.DeepEqual(out, []string{ |
| 559 | "- two123456\n", |
| 560 | "? ^\n", |
| 561 | "+ two123457\n", |
| 562 | "? ^\n", |
| 563 | "- asdf\n", |
| 564 | "+ qwerty\n", |
| 565 | }) != true { |
| 566 | t.Fatal("Differ FancyReplace() failure:", out) |
| 567 | } |
| 568 | // Test no identical no close |
| 569 | aLst = []string{"one\n", "asdf\n", "three\n"} |
| 570 | bLst = []string{"one\n", "qwerty\n", "three\n"} |
| 571 | out, err = diff.FancyReplace(aLst, 1, 2, bLst, 1, 2) |
| 572 | if err != nil { |
| 573 | t.Fatal("Differ FancyReplace() error:", err) |
| 574 | } |
| 575 | if reflect.DeepEqual(out, []string{ |
| 576 | "- asdf\n", |
| 577 | "+ qwerty\n", |
| 578 | }) != true { |
| 579 | t.Fatal("Differ FancyReplace() failure:", out) |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | func TestDifferQFormat(t *testing.T) { |
| 584 | diff := NewDiffer() |
nothing calls this directly
no test coverage detected