diff --git a/test/spec/ProjectManager-test.js b/test/spec/ProjectManager-test.js index c41002ac1fa..5211c062946 100644 --- a/test/spec/ProjectManager-test.js +++ b/test/spec/ProjectManager-test.js @@ -104,6 +104,37 @@ describe("ProjectManager", function() { expect(didCreate).toBeFalsy(); }); }); + + it("should fail when file name contains special characters", function() { + var chars = "/?*:;{}<>\\"; + var i = 0; + var len = chars.length; + var charAt, didCreate, gotError; + + runs(function() { + this.app.ProjectManager.loadProject(this.testPath); + }); + waitsFor(function() { return this.app.ProjectManager.getProjectRoot() }, "loadProject() timeout", 1000); + + for (i = 0; i < len; i++) { + didCreate = false; + gotError = false; + charAt = chars.charAt(i); + + runs(function() { + // skip rename + this.app.ProjectManager.createNewItem(this.testPath, "file" + charAt + ".js", true) + .done(function() { didCreate = true; }) + .fail(function() { gotError = true; }); + }); + waitsFor(function() { return !didCreate && gotError; }, "ProjectManager.createNewItem() timeout", 1000); + + runs(function() { + expect(gotError).toBeTruthy(); + expect(didCreate).toBeFalsy(); + }); + } + }); }); }); \ No newline at end of file