diff options
Diffstat (limited to 'cli/js/os_test.ts')
-rw-r--r-- | cli/js/os_test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/js/os_test.ts b/cli/js/os_test.ts index fa4bf636b..325cbdaa6 100644 --- a/cli/js/os_test.ts +++ b/cli/js/os_test.ts @@ -283,6 +283,23 @@ testPerm({ env: false }, function execPathPerm(): void { assert(caughtError); }); +testPerm({ env: true }, function loadavgSuccess(): void { + const load = Deno.loadavg(); + assertEquals(load.length, 3); +}); + +testPerm({ env: false }, function loadavgPerm(): void { + let caughtError = false; + try { + Deno.loadavg(); + } catch (err) { + caughtError = true; + assert(err instanceof Deno.Err.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); + } + assert(caughtError); +}); + testPerm({ env: true }, function hostnameDir(): void { assertNotEquals(Deno.hostname(), ""); }); |