diff options
author | Nayeem Rahman <muhammed.9939@gmail.com> | 2019-08-13 14:39:01 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-13 09:39:01 -0400 |
commit | 1947f572d735096c1ccd7de2c386b8289c287701 (patch) | |
tree | 71df928d77e790cb2cd37a7c835917030c1d7721 /js/link_test.ts | |
parent | c3afa557515c64610b23ee460f8c6251de421f1a (diff) |
Fix permission requirements for Deno.rename() and Deno.link() (#2737)
Diffstat (limited to 'js/link_test.ts')
-rw-r--r-- | js/link_test.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/js/link_test.ts b/js/link_test.ts index 86e466abf..9425e6eab 100644 --- a/js/link_test.ts +++ b/js/link_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assert, assertEquals } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true, write: true }, function linkSyncSuccess(): void { const testDir = Deno.makeTempDirSync(); @@ -63,7 +63,18 @@ testPerm({ read: true, write: true }, function linkSyncNotFound(): void { assertEquals(err.name, "NotFound"); }); -test(function linkSyncPerm(): void { +testPerm({ read: false, write: true }, function linkSyncReadPerm(): void { + let err; + try { + Deno.linkSync("oldbaddir", "newbaddir"); + } catch (e) { + err = e; + } + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); +}); + +testPerm({ read: true, write: false }, function linkSyncWritePerm(): void { let err; try { Deno.linkSync("oldbaddir", "newbaddir"); |