|
|
@ -21,16 +21,16 @@ func assertLineEqual(t *testing.T, d1 *DiffLine, d2 *DiffLine) { |
|
|
|
|
|
|
|
|
|
|
|
func TestDiffToHTML(t *testing.T) { |
|
|
|
func TestDiffToHTML(t *testing.T) { |
|
|
|
assertEqual(t, "+foo <span class=\"added-code\">bar</span> biz", diffToHTML([]dmp.Diff{ |
|
|
|
assertEqual(t, "+foo <span class=\"added-code\">bar</span> biz", diffToHTML([]dmp.Diff{ |
|
|
|
{dmp.DiffEqual, "foo "}, |
|
|
|
{Type: dmp.DiffEqual, Text: "foo "}, |
|
|
|
{dmp.DiffInsert, "bar"}, |
|
|
|
{Type: dmp.DiffInsert, Text: "bar"}, |
|
|
|
{dmp.DiffDelete, " baz"}, |
|
|
|
{Type: dmp.DiffDelete, Text: " baz"}, |
|
|
|
{dmp.DiffEqual, " biz"}, |
|
|
|
{Type: dmp.DiffEqual, Text: " biz"}, |
|
|
|
}, DiffLineAdd)) |
|
|
|
}, DiffLineAdd)) |
|
|
|
|
|
|
|
|
|
|
|
assertEqual(t, "-foo <span class=\"removed-code\">bar</span> biz", diffToHTML([]dmp.Diff{ |
|
|
|
assertEqual(t, "-foo <span class=\"removed-code\">bar</span> biz", diffToHTML([]dmp.Diff{ |
|
|
|
{dmp.DiffEqual, "foo "}, |
|
|
|
{Type: dmp.DiffEqual, Text: "foo "}, |
|
|
|
{dmp.DiffDelete, "bar"}, |
|
|
|
{Type: dmp.DiffDelete, Text: "bar"}, |
|
|
|
{dmp.DiffInsert, " baz"}, |
|
|
|
{Type: dmp.DiffInsert, Text: " baz"}, |
|
|
|
{dmp.DiffEqual, " biz"}, |
|
|
|
{Type: dmp.DiffEqual, Text: " biz"}, |
|
|
|
}, DiffLineDel)) |
|
|
|
}, DiffLineDel)) |
|
|
|
} |
|
|
|
} |
|
|
|