aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2019-10-15 11:30:15 +0200
committerGitHub <noreply@github.com>2019-10-15 11:30:15 +0200
commitc7e9e20feccc4ad46ab3cdd11f795643c4503685 (patch)
tree0d190415e0dde3bce6fe27bffbc06ab1901c237e /utils
parent8d20cc5916edf7cfa6a9c5ed069f0640dc823c12 (diff)
parent883ed6f63e9a92cb1d25266df5074982774cec8a (diff)
downloadgo-git-c7e9e20feccc4ad46ab3cdd11f795643c4503685.tar.gz
Merge pull request #1225 from sjansen/issues/936
format: diff, Handle no newline at end of file. Fixes #936
Diffstat (limited to 'utils')
-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) {