summaryrefslogtreecommitdiff
path: root/js/os_test.ts
diff options
context:
space:
mode:
authorAaron Power <theaaronepower@gmail.com>2018-08-31 12:51:12 +0100
committerRyan Dahl <ry@tinyclouds.org>2018-08-31 13:18:24 -0400
commitf131445a46555f1634aecae0fc1d4979b4cefa6d (patch)
treefb9847c7f1b6aebc98bc8ef788366dd90b3f9b12 /js/os_test.ts
parent45dafe15ee87b34d0c3c9b4bc72905c176514051 (diff)
Implemented deno.env and refactored flags.rs
Diffstat (limited to 'js/os_test.ts')
-rw-r--r--js/os_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/os_test.ts b/js/os_test.ts
index 7bf1d86a5..cd5ede221 100644
--- a/js/os_test.ts
+++ b/js/os_test.ts
@@ -2,6 +2,27 @@
import { test, testPerm, assert, assertEqual } from "./test_util.ts";
import * as deno from "deno";
+testPerm({ env: true }, async function envSuccess() {
+ const env = deno.env();
+ assert(env !== null);
+ env.test_var = "Hello World";
+ const newEnv = deno.env();
+ assertEqual(env.test_var, newEnv.test_var);
+});
+
+test(async function envFailure() {
+ let caughtError = false;
+ try {
+ const env = deno.env();
+ } catch (err) {
+ caughtError = true;
+ // TODO assert(err instanceof deno.PermissionDenied).
+ assertEqual(err.name, "deno.PermissionDenied");
+ }
+
+ assert(caughtError);
+});
+
// TODO Add tests for modified, accessed, and created fields once there is a way
// to create temp files.
test(async function statSyncSuccess() {