aboutsummaryrefslogtreecommitdiffstats
path: root/utils/diff
diff options
context:
space:
mode:
authorStuart Jansen <sjansen@buscaluz.org>2019-10-13 14:25:56 -0600
committerStuart Jansen <sjansen@buscaluz.org>2019-10-13 15:16:02 -0600
commit883ed6f63e9a92cb1d25266df5074982774cec8a (patch)
tree0d190415e0dde3bce6fe27bffbc06ab1901c237e /utils/diff
parent8d20cc5916edf7cfa6a9c5ed069f0640dc823c12 (diff)
downloadgo-git-883ed6f63e9a92cb1d25266df5074982774cec8a.tar.gz
format: diff, Handle no newline at end of file. Fixes #936
Signed-off-by: Stuart Jansen <sjansen@buscaluz.org>
Diffstat (limited to 'utils/diff')
-rw-r--r--utils/diff/diff_ext_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/utils/diff/diff_ext_test.go b/utils/diff/diff_ext_test.go
index adda276..c6c7e90 100644
--- a/utils/diff/diff_ext_test.go
+++ b/utils/diff/diff_ext_test.go
@@ -99,6 +99,37 @@ var doTests = [...]struct {
{Type: 1, Text: "111\nBCD\n"},
},
},
+ {
+ src: "A\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM\nN\nÑ\nO\nP\nQ\nR\nS\nT\nU\nV\nW\nX\nY\nZ",
+ dst: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\nZ",
+ exp: []diffmatchpatch.Diff{
+ {Type: -1, Text: "A\n"},
+ {Type: 0, Text: "B\nC\nD\nE\nF\nG\n"},
+ {Type: -1, Text: "H\n"},
+ {Type: 0, Text: "I\nJ\nK\nL\nM\nN\n"},
+ {Type: -1, Text: "Ñ\n"},
+ {Type: 0, Text: "O\nP\nQ\nR\nS\nT\n"},
+ {Type: -1, Text: "U\n"},
+ {Type: 0, Text: "V\nW\nX\nY\nZ"},
+ },
+ },
+ {
+ src: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\nZ",
+ dst: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\n",
+ exp: []diffmatchpatch.Diff{
+ {Type: 0, Text: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\n"},
+ {Type: -1, Text: "Z"},
+ },
+ },
+ {
+ src: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\nZ",
+ dst: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY",
+ exp: []diffmatchpatch.Diff{
+ {Type: 0, Text: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\n"},
+ {Type: -1, Text: "Y\nZ"},
+ {Type: 1, Text: "Y"},
+ },
+ },
}
func (s *suiteCommon) TestDo(c *C) {