aboutsummaryrefslogtreecommitdiffstats
path: root/services/gitdiff/gitdiff_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/gitdiff/gitdiff_test.go')
-rw-r--r--services/gitdiff/gitdiff_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/gitdiff/gitdiff_test.go b/services/gitdiff/gitdiff_test.go
index 0dc3f06155..dabb49654e 100644
--- a/services/gitdiff/gitdiff_test.go
+++ b/services/gitdiff/gitdiff_test.go
@@ -42,6 +42,14 @@ func TestDiffToHTML(t *testing.T) {
{Type: dmp.DiffInsert, Text: " baz"},
{Type: dmp.DiffEqual, Text: " biz"},
}, DiffLineDel))
+
+ assertEqual(t, "<span class=\"k\">if</span> <span class=\"p\">!</span><span class=\"nx\">nohl</span> <span class=\"o\">&amp;&amp;</span> <span class=\"added-code\"><span class=\"p\">(</span></span><span class=\"nx\">lexer</span> <span class=\"o\">!=</span> <span class=\"kc\">nil</span><span class=\"added-code\"> <span class=\"o\">||</span> <span class=\"nx\">r</span><span class=\"p\">.</span><span class=\"nx\">GuessLanguage</span><span class=\"p\">)</span></span> <span class=\"p\">{</span>", diffToHTML("", []dmp.Diff{
+ {Type: dmp.DiffEqual, Text: "<span class=\"k\">if</span> <span class=\"p\">!</span><span class=\"nx\">nohl</span> <span class=\"o\">&amp;&amp;</span> <span class=\""},
+ {Type: dmp.DiffInsert, Text: "p\">(</span><span class=\""},
+ {Type: dmp.DiffEqual, Text: "nx\">lexer</span> <span class=\"o\">!=</span> <span class=\"kc\">nil"},
+ {Type: dmp.DiffInsert, Text: "</span> <span class=\"o\">||</span> <span class=\"nx\">r</span><span class=\"p\">.</span><span class=\"nx\">GuessLanguage</span><span class=\"p\">)"},
+ {Type: dmp.DiffEqual, Text: "</span> <span class=\"p\">{</span>"},
+ }, DiffLineAdd))
}
func TestParsePatch(t *testing.T) {