| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ describe("Diff", function() { | |||
| 8 | 8 | var NodeGit = require("../../"); | |
| 9 | 9 | var Repository = NodeGit.Repository; | |
| 10 | 10 | var Diff = NodeGit.Diff; | |
| 11 | + var Blob = NodeGit.Blob; | ||
| 11 | 12 | ||
| 12 | 13 | var reposPath = local("../repos/workdir"); | |
| 13 | 14 | var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6"; | |
@@ -220,6 +221,33 @@ describe("Diff", function() { | |||
| 220 | 221 | }); | |
| 221 | 222 | }); | |
| 222 | 223 | ||
| 224 | + it("can diff the contents of a file to a string with unicode characters", | ||
| 225 | + function(done) { | ||
| 226 | + var evilString = "Unicode’s fun!\nAnd it’s good for you!\n"; | ||
| 227 | + var buffer = new Buffer(evilString); | ||
| 228 | + var oid = Blob.createFromBuffer(this.repository, buffer, buffer.length); | ||
| 229 | + Blob.lookup(this.repository, oid) | ||
| 230 | + .then(function(blob) { | ||
| 231 | + blob.repo = this.repository; | ||
| 232 | + return Diff.blobToBuffer( | ||
| 233 | + blob, | ||
| 234 | + null, | ||
| 235 | + evilString, | ||
| 236 | + null, | ||
| 237 | + null, | ||
| 238 | + null, | ||
| 239 | + null, | ||
| 240 | + function(delta, hunk, payload) { | ||
| 241 | + assert.fail( | ||
| 242 | + "There aren't any changes so this shouldn't be called."); | ||
| 243 | + done(); | ||
| 244 | + }); | ||
| 245 | + }) | ||
| 246 | + .then(function() { | ||
| 247 | + done(); | ||
| 248 | + }); | ||
| 249 | + }); | ||
| 250 | + | ||
| 223 | 251 | it("can diff with a null tree", function() { | |
| 224 | 252 | var repo = this.repository; | |
| 225 | 253 | var tree = this.masterCommitTree; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments