diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
commit | 39dac57259cff8b61db0b22cb2ad0a8adb02692e (patch) | |
tree | 52a026cc8c22793eb17fd0f5e22adce1ae08a1dd /toolkit/components/osfile/tests/xpcshell/test_removeEmptyDir.js | |
parent | a1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff) | |
parent | c2d9ab62f3d097c9e0e00184cab1f546554f5eaa (diff) | |
download | UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.gz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.lz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.xz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.zip |
Merge branch 'redwood' into 28.9-platform
Diffstat (limited to 'toolkit/components/osfile/tests/xpcshell/test_removeEmptyDir.js')
-rw-r--r-- | toolkit/components/osfile/tests/xpcshell/test_removeEmptyDir.js | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/toolkit/components/osfile/tests/xpcshell/test_removeEmptyDir.js b/toolkit/components/osfile/tests/xpcshell/test_removeEmptyDir.js deleted file mode 100644 index 95f8d5cd1..000000000 --- a/toolkit/components/osfile/tests/xpcshell/test_removeEmptyDir.js +++ /dev/null @@ -1,55 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -Components.utils.import("resource://gre/modules/osfile.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); - -do_register_cleanup(function() { - Services.prefs.setBoolPref("toolkit.osfile.log", false); -}); - -function run_test() { - Services.prefs.setBoolPref("toolkit.osfile.log", true); - - run_next_test(); -} - -/** - * Test OS.File.removeEmptyDir - */ -add_task(function() { - // Set up profile. We create the directory in the profile, because the profile - // is removed after every test run. - do_get_profile(); - - let dir = OS.Path.join(OS.Constants.Path.profileDir, "directory"); - - // Sanity checking for the test - do_check_false((yield OS.File.exists(dir))); - - // Remove non-existent directory - yield OS.File.removeEmptyDir(dir); - - // Remove non-existent directory with ignoreAbsent - yield OS.File.removeEmptyDir(dir, {ignoreAbsent: true}); - - // Remove non-existent directory with ignoreAbsent false - let exception = null; - try { - yield OS.File.removeEmptyDir(dir, {ignoreAbsent: false}); - } catch (ex) { - exception = ex; - } - - do_check_true(!!exception); - do_check_true(exception instanceof OS.File.Error); - do_check_true(exception.becauseNoSuchFile); - - // Remove empty directory - yield OS.File.makeDir(dir); - yield OS.File.removeEmptyDir(dir); - do_check_false((yield OS.File.exists(dir))); -}); |