diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/osfile/tests/xpcshell/test_open.js | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/osfile/tests/xpcshell/test_open.js')
-rw-r--r-- | toolkit/components/osfile/tests/xpcshell/test_open.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/toolkit/components/osfile/tests/xpcshell/test_open.js b/toolkit/components/osfile/tests/xpcshell/test_open.js deleted file mode 100644 index 78772ad09..000000000 --- a/toolkit/components/osfile/tests/xpcshell/test_open.js +++ /dev/null @@ -1,70 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -Components.utils.import("resource://gre/modules/osfile.jsm"); - -function run_test() { - run_next_test(); -} - -/** - * Test OS.File.open for reading: - * - with an existing file (should succeed); - * - with a non-existing file (should fail); - * - with inconsistent arguments (should fail). - */ -add_task(function() { - // Attempt to open a file that does not exist, ensure that it yields the - // appropriate error. - try { - let fd = yield OS.File.open(OS.Path.join(".", "This file does not exist")); - do_check_true(false, "File opening 1 succeeded (it should fail)"); - } catch (err if err instanceof OS.File.Error && err.becauseNoSuchFile) { - do_print("File opening 1 failed " + err); - } - - // Attempt to open a file with the wrong args, so that it fails before - // serialization, ensure that it yields the appropriate error. - do_print("Attempting to open a file with wrong arguments"); - try { - let fd = yield OS.File.open(1, 2, 3); - do_check_true(false, "File opening 2 succeeded (it should fail)" + fd); - } catch (err) { - do_print("File opening 2 failed " + err); - do_check_false(err instanceof OS.File.Error, - "File opening 2 returned something that is not a file error"); - do_check_true(err.constructor.name == "TypeError", - "File opening 2 returned a TypeError"); - } - - // Attempt to open a file correctly - do_print("Attempting to open a file correctly"); - let openedFile = yield OS.File.open(OS.Path.join(do_get_cwd().path, "test_open.js")); - do_print("File opened correctly"); - - do_print("Attempting to close a file correctly"); - yield openedFile.close(); - - do_print("Attempting to close a file again"); - yield openedFile.close(); -}); - -/** - * Test the error thrown by OS.File.open when attempting to open a directory - * that does not exist. - */ -add_task(function test_error_attributes () { - - let dir = OS.Path.join(do_get_profile().path, "test_osfileErrorAttrs"); - let fpath = OS.Path.join(dir, "test_error_attributes.txt"); - - try { - yield OS.File.open(fpath, {truncate: true}, {}); - do_check_true(false, "Opening path suceeded (it should fail) " + fpath); - } catch (err) { - do_check_true(err instanceof OS.File.Error); - do_check_true(err.becauseNoSuchFile); - } -}); |