MCPcopy Create free account
hub / github.com/sergi/go-diff / TestDiffPrettyHtml

Function TestDiffPrettyHtml

diffmatchpatch/diff_test.go:992–1015  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

990}
991
992func TestDiffPrettyHtml(t *testing.T) {
993 type TestCase struct {
994 Diffs []Diff
995
996 Expected string
997 }
998
999 dmp := New()
1000
1001 for i, tc := range []TestCase{
1002 {
1003 Diffs: []Diff{
1004 {DiffEqual, "a\n"},
1005 {DiffDelete, "<B>b</B>"},
1006 {DiffInsert, "c&d"},
1007 },
1008
1009 Expected: "<span>a&para;<br></span><del style=\"background:#ffe6e6;\">&lt;B&gt;b&lt;/B&gt;</del><ins style=\"background:#e6ffe6;\">c&amp;d</ins>",
1010 },
1011 } {
1012 actual := dmp.DiffPrettyHtml(tc.Diffs)
1013 assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc))
1014 }
1015}
1016
1017func TestDiffPrettyText(t *testing.T) {
1018 type TestCase struct {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
DiffPrettyHtmlMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…