summaryrefslogtreecommitdiff
path: root/js/read_file_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/read_file_test.ts')
-rw-r--r--js/read_file_test.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/js/read_file_test.ts b/js/read_file_test.ts
index 34b391345..aff28e64c 100644
--- a/js/read_file_test.ts
+++ b/js/read_file_test.ts
@@ -1,9 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { testPerm, assert, assertEqual } from "./test_util.ts";
-import * as deno from "deno";
testPerm({ read: true }, function readFileSyncSuccess() {
- const data = deno.readFileSync("package.json");
+ const data = Deno.readFileSync("package.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
@@ -14,10 +13,10 @@ testPerm({ read: true }, function readFileSyncSuccess() {
testPerm({ read: false }, function readFileSyncPerm() {
let caughtError = false;
try {
- const data = deno.readFileSync("package.json");
+ const data = Deno.readFileSync("package.json");
} catch (e) {
caughtError = true;
- assertEqual(e.kind, deno.ErrorKind.PermissionDenied);
+ assertEqual(e.kind, Deno.ErrorKind.PermissionDenied);
assertEqual(e.name, "PermissionDenied");
}
assert(caughtError);
@@ -27,17 +26,17 @@ testPerm({ read: true }, function readFileSyncNotFound() {
let caughtError = false;
let data;
try {
- data = deno.readFileSync("bad_filename");
+ data = Deno.readFileSync("bad_filename");
} catch (e) {
caughtError = true;
- assertEqual(e.kind, deno.ErrorKind.NotFound);
+ assertEqual(e.kind, Deno.ErrorKind.NotFound);
}
assert(caughtError);
assert(data === undefined);
});
testPerm({ read: true }, async function readFileSuccess() {
- const data = await deno.readFile("package.json");
+ const data = await Deno.readFile("package.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
@@ -48,10 +47,10 @@ testPerm({ read: true }, async function readFileSuccess() {
testPerm({ read: false }, async function readFilePerm() {
let caughtError = false;
try {
- await deno.readFile("package.json");
+ await Deno.readFile("package.json");
} catch (e) {
caughtError = true;
- assertEqual(e.kind, deno.ErrorKind.PermissionDenied);
+ assertEqual(e.kind, Deno.ErrorKind.PermissionDenied);
assertEqual(e.name, "PermissionDenied");
}
assert(caughtError);