diff options
Diffstat (limited to 'cli/tests/unit/os_test.ts')
-rw-r--r-- | cli/tests/unit/os_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index 9698692c7..deb0385a8 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -326,6 +326,22 @@ unitTest({ perms: { env: false } }, function hostnamePerm(): void { assert(caughtError); }); +unitTest({ perms: { env: true } }, function osName(): void { + assertNotEquals(Deno.osName(), ""); +}); + +unitTest({ perms: { env: false } }, function osNamePerm(): void { + let caughtError = false; + try { + Deno.osName(); + } catch (err) { + caughtError = true; + assert(err instanceof Deno.errors.PermissionDenied); + assertEquals(err.name, "PermissionDenied"); + } + assert(caughtError); +}); + unitTest({ perms: { env: true } }, function releaseDir(): void { assertNotEquals(Deno.osRelease(), ""); }); |