testing/xpcshell/example/unit/test_get_file.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 var subscriptLoaded = false;
     8 function run_test() {
     9   var lf = do_get_file("file.txt");
    10   do_check_true(lf.exists());
    11   do_check_true(lf.isFile());
    12   // check that allowNonexistent works
    13   lf = do_get_file("file.txt.notfound", true);
    14   do_check_false(lf.exists());
    15   // check that we can get a file from a subdirectory
    16   lf = do_get_file("subdir/file.txt");
    17   do_check_true(lf.exists());
    18   do_check_true(lf.isFile());
    19   // and that we can get a handle to a directory itself
    20   lf = do_get_file("subdir/");
    21   do_check_true(lf.exists());
    22   do_check_true(lf.isDirectory());
    23   // check that we can go up a level
    24   lf = do_get_file("..");
    25   do_check_true(lf.exists());
    26   lf.append("unit");
    27   lf.append("file.txt");
    28   do_check_true(lf.exists());
    29   // check that do_get_cwd works
    30   lf = do_get_cwd();
    31   do_check_true(lf.exists());
    32   do_check_true(lf.isDirectory());
    33 }

mercurial