From 6ccf9037a6b36c81ea0e6ac12d0e2dbd793f6114 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Thu, 11 Jun 2020 22:56:26 +0545 Subject: feat: add Deno.osName() (#5714) --- cli/tests/unit/os_test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cli/tests/unit') 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(), ""); }); -- cgit v1.2.3