summaryrefslogtreecommitdiff
path: root/js/os_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/os_test.ts')
-rw-r--r--js/os_test.ts16
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);
+});