modules/libjar/zipwriter/test/unit/test_directory.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/libjar/zipwriter/test/unit/test_directory.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 + */
     1.8 +
     1.9 +const DIRNAME1 = "test";
    1.10 +const DIRNAME1_CORRECT = "test/";
    1.11 +const DIRNAME2 = "test2/";
    1.12 +const time = Date.now();
    1.13 +
    1.14 +function run_test()
    1.15 +{
    1.16 +  zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
    1.17 +
    1.18 +  zipW.addEntryDirectory(DIRNAME1, time * PR_USEC_PER_MSEC, false);
    1.19 +  do_check_false(zipW.hasEntry(DIRNAME1));
    1.20 +  do_check_true(zipW.hasEntry(DIRNAME1_CORRECT));
    1.21 +  var entry = zipW.getEntry(DIRNAME1_CORRECT);
    1.22 +  do_check_true(entry.isDirectory);
    1.23 +
    1.24 +  zipW.addEntryDirectory(DIRNAME2, time * PR_USEC_PER_MSEC, false);
    1.25 +  do_check_true(zipW.hasEntry(DIRNAME2));
    1.26 +  entry = zipW.getEntry(DIRNAME2);
    1.27 +  do_check_true(entry.isDirectory);
    1.28 +
    1.29 +  zipW.close();
    1.30 +}

mercurial