-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: diff files now have unique paths (#694)
- Loading branch information
1 parent
1d2f922
commit 0ff8666
Showing
3 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as assert from "assert"; | ||
import { Uri } from "vscode"; | ||
import { exists } from "../fs/exists"; | ||
import { readFile } from "../fs/read_file"; | ||
import * as os from "os"; | ||
import { join } from "path"; | ||
import { createTempSvnRevisionFile } from "../tempFiles"; | ||
|
||
/* | ||
On windows node will return the temp fir in the C drive as 'C:\' | ||
where url.fspath will start with 'c:\' | ||
*/ | ||
let osTmpDir = os.tmpdir(); | ||
osTmpDir = osTmpDir[0].toLowerCase() + osTmpDir.substr(1); | ||
const tempRevisionPath = join( | ||
osTmpDir, | ||
"vscode-svn", | ||
"1181ae15a77d83ac0b077051dfed21ed", | ||
"r30_test.js" | ||
); | ||
|
||
suite("Test temp file creation", () => { | ||
test("Temp files matches expected", async () => { | ||
const svnUri = Uri.parse("http://example.com/svn/test/trunk/test.js"); | ||
|
||
const revisionUri = await createTempSvnRevisionFile( | ||
svnUri, | ||
"30", | ||
"test content" | ||
); | ||
|
||
assert.equal(revisionUri.fsPath, tempRevisionPath); | ||
}); | ||
|
||
test("Temp file is created", async () => { | ||
const svnUri = Uri.parse("http://example.com/svn/test/trunk/test.js"); | ||
|
||
await createTempSvnRevisionFile(svnUri, "30", "test content"); | ||
|
||
assert.ok(await exists(tempRevisionPath)); | ||
}); | ||
|
||
test("Temp contents are correct", async () => { | ||
const svnUri = Uri.parse("http://example.com/svn/test/trunk/test.js"); | ||
|
||
const revisionUri = await createTempSvnRevisionFile( | ||
svnUri, | ||
"30", | ||
"test content" | ||
); | ||
|
||
assert.equal(await readFile(revisionUri.fsPath), "test content"); | ||
}); | ||
}); |