test_directory.js (829B)
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 zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE); 13 14 zipW.addEntryDirectory(DIRNAME1, time * PR_USEC_PER_MSEC, false); 15 Assert.ok(!zipW.hasEntry(DIRNAME1)); 16 Assert.ok(zipW.hasEntry(DIRNAME1_CORRECT)); 17 var entry = zipW.getEntry(DIRNAME1_CORRECT); 18 Assert.ok(entry.isDirectory); 19 20 zipW.addEntryDirectory(DIRNAME2, time * PR_USEC_PER_MSEC, false); 21 Assert.ok(zipW.hasEntry(DIRNAME2)); 22 entry = zipW.getEntry(DIRNAME2); 23 Assert.ok(entry.isDirectory); 24 25 zipW.close(); 26 }