test_get_file.js (1026B)
1 /* vim:set ts=2 sw=2 sts=2 et: */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 function run_test() { 7 var lf = do_get_file("file.txt"); 8 Assert.ok(lf.exists()); 9 Assert.ok(lf.isFile()); 10 // check that allowNonexistent works 11 lf = do_get_file("file.txt.notfound", true); 12 Assert.ok(!lf.exists()); 13 // check that we can get a file from a subdirectory 14 lf = do_get_file("subdir/file.txt"); 15 Assert.ok(lf.exists()); 16 Assert.ok(lf.isFile()); 17 // and that we can get a handle to a directory itself 18 lf = do_get_file("subdir/"); 19 Assert.ok(lf.exists()); 20 Assert.ok(lf.isDirectory()); 21 // check that we can go up a level 22 lf = do_get_file(".."); 23 Assert.ok(lf.exists()); 24 lf.append("unit"); 25 lf.append("file.txt"); 26 Assert.ok(lf.exists()); 27 // check that do_get_cwd works 28 lf = do_get_cwd(); 29 Assert.ok(lf.exists()); 30 Assert.ok(lf.isDirectory()); 31 }