-
Couldn't load subscription status.
- Fork 7.6k
Add encodeFilePath to FileUtils to convert file paths into encoded strings (replace metacharacters such as %, @, $, #, etc.) #9190
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,6 +183,21 @@ define(function (require, exports, module) { | |
| }); | ||
| }); | ||
|
|
||
| describe("encodeFilePath", function () { | ||
|
|
||
| it("should encode symbols in path", function () { | ||
| expect(FileUtils.encodeFilePath("#?@test&\".js")).toBe("%23%3F%40test%26%22.js"); | ||
| }); | ||
|
|
||
| it("should work with a common path", function () { | ||
| expect(FileUtils.encodeFilePath("C:/test/$data.txt")).toBe("C%3A/test/%24data.txt"); | ||
| }); | ||
|
|
||
| it("should work with a path with no special symbols", function () { | ||
| expect(FileUtils.encodeFilePath("/Applications/Test/test.html")).toBe("/Applications/Test/test.html"); | ||
| }); | ||
| }); | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need a test for every single char. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And btw, we usually use something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that the tests for FileUtils are all listed as Integration, even though some are unit tests. Is this a bug? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ehm, they are listed under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, perhaps that was a different unit test. Will report if I see again. |
||
| describe("compareFilenames", function () { | ||
|
|
||
| it("should compare filenames using German rules", function () { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add a short comment here, something like: