mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 01:29:14 -05:00
34 lines
876 B
TypeScript
34 lines
876 B
TypeScript
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
import { test, testPerm, assert, assertEquals } from "./test_util.ts";
|
|
|
|
testPerm({ env: true }, function envSuccess() {
|
|
const env = Deno.env();
|
|
assert(env !== null);
|
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
env.test_var = "Hello World";
|
|
const newEnv = Deno.env();
|
|
assertEquals(env.test_var, newEnv.test_var);
|
|
});
|
|
|
|
test(function envFailure() {
|
|
let caughtError = false;
|
|
try {
|
|
Deno.env();
|
|
} catch (err) {
|
|
caughtError = true;
|
|
assertEquals(err.kind, Deno.ErrorKind.PermissionDenied);
|
|
assertEquals(err.name, "PermissionDenied");
|
|
}
|
|
|
|
assert(caughtError);
|
|
});
|
|
|
|
test(function osPid() {
|
|
console.log("pid", Deno.pid);
|
|
assert(Deno.pid > 0);
|
|
});
|
|
|
|
// See complete tests in tools/is_tty_test.py
|
|
test(function osIsTTYSmoke() {
|
|
console.log(Deno.isTTY());
|
|
});
|