1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/tests/unit/test_bug476919.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +const Cc = Components.classes; 1.5 +const Ci = Components.interfaces; 1.6 + 1.7 +function run_test() { 1.8 + // skip this test on Windows 1.9 + var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes); 1.10 + if (!isWindows) { 1.11 + var testDir = __LOCATION__.parent; 1.12 + // create a test file, then symlink it, then check that we think it's a symlink 1.13 + var targetFile = testDir.clone(); 1.14 + targetFile.append("target.txt"); 1.15 + if (!targetFile.exists()) 1.16 + targetFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0644); 1.17 + 1.18 + var link = testDir.clone(); 1.19 + link.append("link"); 1.20 + if (link.exists()) 1.21 + link.remove(false); 1.22 + 1.23 + var ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); 1.24 + ln.initWithPath("/bin/ln"); 1.25 + var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); 1.26 + process.init(ln); 1.27 + var args = ["-s", targetFile.path, link.path]; 1.28 + process.run(true, args, args.length); 1.29 + do_check_true(link.isSymlink()); 1.30 + } 1.31 +}