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

Function TestDiffPrettyHtml

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

Source from the content-addressed store, hash-verified

1014}
1015
1016func TestDiffPrettyHtml(t *testing.T) {
1017 type TestCase struct {
1018 Diffs []Diff
1019
1020 Expected string
1021 }
1022
1023 dmp := New()
1024
1025 for i, tc := range []TestCase{
1026 {
1027 Diffs: []Diff{
1028 {DiffEqual, "a\n"},
1029 {DiffDelete, "<B>b</B>"},
1030 {DiffInsert, "c&d"},
1031 },
1032
1033 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>",
1034 },
1035 } {
1036 actual := dmp.DiffPrettyHtml(tc.Diffs)
1037 assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc))
1038 }
1039}
1040
1041func TestDiffPrettyText(t *testing.T) {
1042 type TestCase struct {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
DiffPrettyHtmlMethod · 0.80

Tested by

no test coverage detected