aboutsummaryrefslogtreecommitdiffstats
path: root/diff/diff_ext_test.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-12-14 23:12:44 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-12-14 23:12:44 +0100
commit0af572dd21c0aa79d13745b633ee24ba6c4d6cf1 (patch)
tree49e81e74e82d84fd88b2fc1e4b0dc7c7bfe9c40f /diff/diff_ext_test.go
parentdf0f38af83f972f026d7e14150f3d37b95f13484 (diff)
downloadgo-git-0af572dd21c0aa79d13745b633ee24ba6c4d6cf1.tar.gz
move plumbing from top level package to plumbing (#183)
* plumbing: rename Object -> EncodedObject. * plumbing/storer: rename ObjectStorer -> EncodedObjectStorer. * move difftree to plumbing/difftree. * move diff -> utils/diff * make Object/Tag/Blob/Tree/Commit/File depend on storer. * Object and its implementations now depend only on storer.EncodedObjectStorer, not git.Repository. * Tests are decoupled accordingly. * move Object/Commit/File/Tag/Tree to plumbing/object. * move Object/Commit/File/Tag/Tree to plumbing/object. * move checkClose to utils/ioutil. * move RevListObjects to plumbing/revlist.Objects. * move DiffTree to plumbing/difftree package. * rename files with plural nouns to singular * plumbing/object: add GetBlob/GetCommit/GetTag/GetTree.
Diffstat (limited to 'diff/diff_ext_test.go')
-rw-r--r--diff/diff_ext_test.go109
1 files changed, 0 insertions, 109 deletions
diff --git a/diff/diff_ext_test.go b/diff/diff_ext_test.go
deleted file mode 100644
index 484c26e..0000000
--- a/diff/diff_ext_test.go
+++ /dev/null
@@ -1,109 +0,0 @@
-package diff_test
-
-import (
- "testing"
-
- "gopkg.in/src-d/go-git.v4/diff"
-
- "github.com/sergi/go-diff/diffmatchpatch"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) { TestingT(t) }
-
-type suiteCommon struct{}
-
-var _ = Suite(&suiteCommon{})
-
-var diffTests = [...]struct {
- src string // the src string to diff
- dst string // the dst string to diff
-}{
- // equal inputs
- {"", ""},
- {"a", "a"},
- {"a\n", "a\n"},
- {"a\nb", "a\nb"},
- {"a\nb\n", "a\nb\n"},
- {"a\nb\nc", "a\nb\nc"},
- {"a\nb\nc\n", "a\nb\nc\n"},
- // missing '\n'
- {"", "\n"},
- {"\n", ""},
- {"a", "a\n"},
- {"a\n", "a"},
- {"a\nb", "a\nb"},
- {"a\nb\n", "a\nb\n"},
- {"a\nb\nc", "a\nb\nc"},
- {"a\nb\nc\n", "a\nb\nc\n"},
- // generic
- {"a\nbbbbb\n\tccc\ndd\n\tfffffffff\n", "bbbbb\n\tccc\n\tDD\n\tffff\n"},
-}
-
-func (s *suiteCommon) TestAll(c *C) {
- for i, t := range diffTests {
- diffs := diff.Do(t.src, t.dst)
- src := diff.Src(diffs)
- dst := diff.Dst(diffs)
- c.Assert(src, Equals, t.src, Commentf("subtest %d, src=%q, dst=%q, bad calculated src", i, t.src, t.dst))
- c.Assert(dst, Equals, t.dst, Commentf("subtest %d, src=%q, dst=%q, bad calculated dst", i, t.src, t.dst))
- }
-}
-
-var doTests = [...]struct {
- src, dst string
- exp []diffmatchpatch.Diff
-}{
- {
- src: "",
- dst: "",
- exp: []diffmatchpatch.Diff{},
- },
- {
- src: "a",
- dst: "a",
- exp: []diffmatchpatch.Diff{
- {
- Type: 0,
- Text: "a",
- },
- },
- },
- {
- src: "",
- dst: "abc\ncba",
- exp: []diffmatchpatch.Diff{
- {
- Type: 1,
- Text: "abc\ncba",
- },
- },
- },
- {
- src: "abc\ncba",
- dst: "",
- exp: []diffmatchpatch.Diff{
- {
- Type: -1,
- Text: "abc\ncba",
- },
- },
- },
- {
- src: "abc\nbcd\ncde",
- dst: "000\nabc\n111\nBCD\n",
- exp: []diffmatchpatch.Diff{
- {Type: 1, Text: "000\n"},
- {Type: 0, Text: "abc\n"},
- {Type: -1, Text: "bcd\ncde"},
- {Type: 1, Text: "111\nBCD\n"},
- },
- },
-}
-
-func (s *suiteCommon) TestDo(c *C) {
- for i, t := range doTests {
- diffs := diff.Do(t.src, t.dst)
- c.Assert(diffs, DeepEquals, t.exp, Commentf("subtest %d", i))
- }
-}