no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / xpcom / tests / unit / test_windows_cmdline_file.js
blob318f93ebecb5313779158e96cf40f3f60a814cad
1 let executableFile = Services.dirsvc.get("CurProcD", Ci.nsIFile);
2 executableFile.append("xpcshell.exe");
3 function run_test() {
4   let quote = '"'; // Windows' cmd processor doesn't actually use single quotes.
5   for (let suffix of ["", " -osint", ` --blah "%PROGRAMFILES%"`]) {
6     let cmdline = quote + executableFile.path + quote + suffix;
7     info(`Testing with ${cmdline}`);
8     let f = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFileWin);
9     f.initWithCommandLine(cmdline);
10     Assert.equal(
11       f.path,
12       executableFile.path,
13       "Should be able to recover executable path"
14     );
15   }
17   let f = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFileWin);
18   f.initWithCommandLine("%ComSpec% -c echo 'hi'");
19   let cmd = Services.dirsvc.get("SysD", Ci.nsIFile);
20   cmd.append("cmd.exe");
21   Assert.equal(f.path, cmd.path, "Should be able to replace env vars.");