diff options
author | Unknwon <u@gogs.io> | 2017-04-04 01:45:57 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-04 01:45:57 -0400 |
commit | 55afc1ad21a6c5bebe7f7f8b6df8b0ee4308ba10 (patch) | |
tree | 685c2c0e975481a079aee2b146cb8790d7efb6e3 /models/git_diff_test.go | |
parent | 16c6ca72cd4cd4d686fd5142794f883343c3aed0 (diff) |
models/repo_diff: move core functions to gogits/git-module
Diffstat (limited to 'models/git_diff_test.go')
-rw-r--r-- | models/git_diff_test.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/models/git_diff_test.go b/models/git_diff_test.go index 7f390adb..74032371 100644 --- a/models/git_diff_test.go +++ b/models/git_diff_test.go @@ -1,9 +1,15 @@ +// Copyright 2016 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package models import ( - dmp "github.com/sergi/go-diff/diffmatchpatch" "html/template" "testing" + + "github.com/gogits/git-module" + dmp "github.com/sergi/go-diff/diffmatchpatch" ) func assertEqual(t *testing.T, s1 string, s2 template.HTML) { @@ -12,24 +18,24 @@ func assertEqual(t *testing.T, s1 string, s2 template.HTML) { } } -func assertLineEqual(t *testing.T, d1 *DiffLine, d2 *DiffLine) { +func assertLineEqual(t *testing.T, d1 *git.DiffLine, d2 *git.DiffLine) { if d1 != d2 { t.Errorf("%v should be equal %v", d1, d2) } } -func TestDiffToHTML(t *testing.T) { +func Test_diffToHTML(t *testing.T) { assertEqual(t, "+foo <span class=\"added-code\">bar</span> biz", diffToHTML([]dmp.Diff{ dmp.Diff{dmp.DiffEqual, "foo "}, dmp.Diff{dmp.DiffInsert, "bar"}, dmp.Diff{dmp.DiffDelete, " baz"}, dmp.Diff{dmp.DiffEqual, " biz"}, - }, DIFF_LINE_ADD)) + }, git.DIFF_LINE_ADD)) assertEqual(t, "-foo <span class=\"removed-code\">bar</span> biz", diffToHTML([]dmp.Diff{ dmp.Diff{dmp.DiffEqual, "foo "}, dmp.Diff{dmp.DiffDelete, "bar"}, dmp.Diff{dmp.DiffInsert, " baz"}, dmp.Diff{dmp.DiffEqual, " biz"}, - }, DIFF_LINE_DEL)) + }, git.DIFF_LINE_DEL)) } |