| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,8 +28,9 @@ describe("Stage", function() { | |||
| 28 | 28 | return fse.remove(test.repository.workdir()); | |
| 29 | 29 | }); | |
| 30 | 30 | ||
| 31 | - function stagingTest(staging) { | ||
| 32 | - var fileContent = "One line of text\n" + | ||
| 31 | + function stagingTest(staging, newFileContent) { | ||
| 32 | + var fileContent = newFileContent || | ||
| 33 | + "One line of text\n" + | ||
| 33 | 34 | "Two lines of text\n"+ | |
| 34 | 35 | "Three lines of text\n"+ | |
| 35 | 36 | "Four lines of text\n"+ | |
@@ -137,7 +138,7 @@ function stagingTest(staging) { | |||
| 137 | 138 | return test.repository.getBlob(pathOid); | |
| 138 | 139 | }) | |
| 139 | 140 | .then(function(resultFileContents) { | |
| 140 | - assert.equal(resultFileContents, stagedFile); | ||
| 141 | + assert.equal(resultFileContents.toString(), stagedFile); | ||
| 141 | 142 | }); | |
| 142 | 143 | } | |
| 143 | 144 | ||
@@ -147,4 +148,38 @@ function stagingTest(staging) { | |||
| 147 | 148 | it("can unstage selected lines", function() { | |
| 148 | 149 | return stagingTest(false); | |
| 149 | 150 | }); | |
| 151 | + | ||
| 152 | + //This is used to test cases where there are no newline at EOF | ||
| 153 | + var newlineEofTestFileContent = | ||
| 154 | + "One line of text\n" + | ||
| 155 | + "Two lines of text\n"+ | ||
| 156 | + "Three lines of text\n"+ | ||
| 157 | + "Four lines of text\n"+ | ||
| 158 | + "Five lines of text\n"+ | ||
| 159 | + "Six lines of text\n"+ | ||
| 160 | + "Seven lines of text\n"+ | ||
| 161 | + "Eight lines of text\n"+ | ||
| 162 | + "Nine lines of text\n"+ | ||
| 163 | + "Ten lines of text\n"+ | ||
| 164 | + "Eleven lines of text\n"+ | ||
| 165 | + "Twelve lines of text\n"+ | ||
| 166 | + "Thirteen lines of text\n"+ | ||
| 167 | + "Fourteen lines of text\n"+ | ||
| 168 | + "Fifteen lines of text"; | ||
| 169 | + it("can stage last line with no newline at EOF", function() { | ||
| 170 | + return stagingTest(true, newlineEofTestFileContent); | ||
| 171 | + }); | ||
| 172 | + it("can unstage last line with no newline at EOF", function() { | ||
| 173 | + return stagingTest(false, newlineEofTestFileContent); | ||
| 174 | + }); | ||
| 175 | + it("can stage second to last line with no newline at EOF", function() { | ||
| 176 | + var newlineEofTestFileContent2 = newlineEofTestFileContent + | ||
| 177 | + "\nSixteen lines of text\nSeventeen lines of text\nEighteen lines of text"; | ||
| 178 | + return stagingTest(true, newlineEofTestFileContent2); | ||
| 179 | + }); | ||
| 180 | + it("can unstage second to last line with no newline at EOF", function() { | ||
| 181 | + var newlineEofTestFileContent2 = newlineEofTestFileContent + | ||
| 182 | + "\nSixteen lines of text\nSeventeen lines of text\nEighteen lines of text"; | ||
| 183 | + return stagingTest(false, newlineEofTestFileContent2); | ||
| 184 | + }); | ||
| 150 | 185 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments