testing/xpcshell/example/unit/test_get_file.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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