MCPcopy Create free account
hub / github.com/cogentcore/core / TestDifferCompare

Function TestDifferCompare

texteditor/difflib/bytes/bytes_test.go:523–543  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

521}
522
523func TestDifferCompare(t *testing.T) {
524 diff := NewDiffer()
525 // Test
526 aLst := stringsToBytes("foo\n", "bar\n", "baz\n")
527 bLst := stringsToBytes("foo\n", "bar1\n", "asdf\n", "baz\n")
528 out, err := diff.Compare(aLst, bLst)
529 if err != nil {
530 t.Fatal("Differ Compare() error:", err)
531 }
532 out2 := bytesToStrings(out...)
533 if reflect.DeepEqual(out2, []string{
534 " foo\n",
535 "- bar\n",
536 "+ bar1\n",
537 "? +\n",
538 "+ asdf\n",
539 " baz\n",
540 }) != true {
541 t.Fatal("Differ Compare failure:", out2)
542 }
543}
544
545func TestDifferStructuredDump(t *testing.T) {
546 diff := NewDiffer()

Callers

nothing calls this directly

Calls 4

CompareMethod · 0.95
stringsToBytesFunction · 0.85
bytesToStringsFunction · 0.85
NewDifferFunction · 0.70

Tested by

no test coverage detected