1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-27 13:28:54 +00:00
Files
UXP/testing/xpcshell/example/unit/test_get_file.js
T
Moonchild a39fd9e75f Issue #1656 - Remove more vim control lines.
Vim control lines were re-introduced or not entirely cleaned up.
This nukes them again.
Removing from modules, netwerk, security, storage, testing, toolkit, and
a few scattered misc files. More to come.
2023-05-05 22:59:16 +08:00

33 lines
1.0 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var subscriptLoaded = false;
function run_test() {
var lf = do_get_file("file.txt");
do_check_true(lf.exists());
do_check_true(lf.isFile());
// check that allowNonexistent works
lf = do_get_file("file.txt.notfound", true);
do_check_false(lf.exists());
// check that we can get a file from a subdirectory
lf = do_get_file("subdir/file.txt");
do_check_true(lf.exists());
do_check_true(lf.isFile());
// and that we can get a handle to a directory itself
lf = do_get_file("subdir/");
do_check_true(lf.exists());
do_check_true(lf.isDirectory());
// check that we can go up a level
lf = do_get_file("..");
do_check_true(lf.exists());
lf.append("unit");
lf.append("file.txt");
do_check_true(lf.exists());
// check that do_get_cwd works
lf = do_get_cwd();
do_check_true(lf.exists());
do_check_true(lf.isDirectory());
}