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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:aa3b59c487ac
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 */
5
6 const DIRNAME1 = "test";
7 const DIRNAME1_CORRECT = "test/";
8 const DIRNAME2 = "test2/";
9 const time = Date.now();
10
11 function run_test()
12 {
13 zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
14
15 zipW.addEntryDirectory(DIRNAME1, time * PR_USEC_PER_MSEC, false);
16 do_check_false(zipW.hasEntry(DIRNAME1));
17 do_check_true(zipW.hasEntry(DIRNAME1_CORRECT));
18 var entry = zipW.getEntry(DIRNAME1_CORRECT);
19 do_check_true(entry.isDirectory);
20
21 zipW.addEntryDirectory(DIRNAME2, time * PR_USEC_PER_MSEC, false);
22 do_check_true(zipW.hasEntry(DIRNAME2));
23 entry = zipW.getEntry(DIRNAME2);
24 do_check_true(entry.isDirectory);
25
26 zipW.close();
27 }

mercurial