summaryrefslogtreecommitdiff
path: root/js/rename_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/rename_test.ts')
-rw-r--r--js/rename_test.ts29
1 files changed, 14 insertions, 15 deletions
diff --git a/js/rename_test.ts b/js/rename_test.ts
index 33c7d06ef..0d48169d0 100644
--- a/js/rename_test.ts
+++ b/js/rename_test.ts
@@ -1,24 +1,23 @@
// 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, write: true }, function renameSyncSuccess() {
- const testDir = deno.makeTempDirSync();
+ const testDir = Deno.makeTempDirSync();
const oldpath = testDir + "/oldpath";
const newpath = testDir + "/newpath";
- deno.mkdirSync(oldpath);
- deno.renameSync(oldpath, newpath);
- const newPathInfo = deno.statSync(newpath);
+ Deno.mkdirSync(oldpath);
+ Deno.renameSync(oldpath, newpath);
+ const newPathInfo = Deno.statSync(newpath);
assert(newPathInfo.isDirectory());
let caughtErr = false;
let oldPathInfo;
try {
- oldPathInfo = deno.statSync(oldpath);
+ oldPathInfo = Deno.statSync(oldpath);
} catch (e) {
caughtErr = true;
- assertEqual(e.kind, deno.ErrorKind.NotFound);
+ assertEqual(e.kind, Deno.ErrorKind.NotFound);
}
assert(caughtErr);
assertEqual(oldPathInfo, undefined);
@@ -29,31 +28,31 @@ testPerm({ read: true, write: false }, function renameSyncPerm() {
try {
const oldpath = "/oldbaddir";
const newpath = "/newbaddir";
- deno.renameSync(oldpath, newpath);
+ Deno.renameSync(oldpath, newpath);
} catch (e) {
err = e;
}
- assertEqual(err.kind, deno.ErrorKind.PermissionDenied);
+ assertEqual(err.kind, Deno.ErrorKind.PermissionDenied);
assertEqual(err.name, "PermissionDenied");
});
testPerm({ read: true, write: true }, async function renameSuccess() {
- const testDir = deno.makeTempDirSync();
+ const testDir = Deno.makeTempDirSync();
const oldpath = testDir + "/oldpath";
const newpath = testDir + "/newpath";
- deno.mkdirSync(oldpath);
- await deno.rename(oldpath, newpath);
- const newPathInfo = deno.statSync(newpath);
+ Deno.mkdirSync(oldpath);
+ await Deno.rename(oldpath, newpath);
+ const newPathInfo = Deno.statSync(newpath);
assert(newPathInfo.isDirectory());
let caughtErr = false;
let oldPathInfo;
try {
- oldPathInfo = deno.statSync(oldpath);
+ oldPathInfo = Deno.statSync(oldpath);
} catch (e) {
caughtErr = true;
- assertEqual(e.kind, deno.ErrorKind.NotFound);
+ assertEqual(e.kind, Deno.ErrorKind.NotFound);
}
assert(caughtErr);
assertEqual(oldPathInfo, undefined);