testing/xpcshell/example/unit/test_get_file.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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