diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-09-27 16:09:42 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-09-27 19:09:42 -0400 |
commit | 6efca6d1a17638136eadf39644f392f9107a4a6c (patch) | |
tree | 6aedab40214d21396122a97b4e6335a0f084a079 /js/os_test.ts | |
parent | d36391ad20afe56aaa6e42fd63597221636fdfcb (diff) |
Add Deno.hostname() (#3032)
Diffstat (limited to 'js/os_test.ts')
-rw-r--r-- | js/os_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/js/os_test.ts b/js/os_test.ts index 28c8b6a0b..ad3772631 100644 --- a/js/os_test.ts +++ b/js/os_test.ts @@ -70,3 +70,19 @@ testPerm({ env: false }, function execPathPerm(): void { } assert(caughtError); }); + +testPerm({ env: true }, function hostnameDir(): void { + assertNotEquals(Deno.hostname(), ""); +}); + +testPerm({ env: false }, function hostnamePerm(): void { + let caughtError = false; + try { + Deno.hostname(); + } catch (err) { + caughtError = true; + assertEquals(err.kind, Deno.ErrorKind.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); + } + assert(caughtError); +}); |