0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
denoland-deno/js/os_test.ts

34 lines
825 B
TypeScript
Raw Normal View History

2019-01-21 14:03:30 -05:00
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
2018-08-30 13:49:24 -04:00
import { test, testPerm, assert, assertEqual } from "./test_util.ts";
testPerm({ env: true }, 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(function envFailure() {
let caughtError = false;
try {
const env = Deno.env();
} catch (err) {
caughtError = true;
assertEqual(err.kind, Deno.ErrorKind.PermissionDenied);
assertEqual(err.name, "PermissionDenied");
}
assert(caughtError);
});
2019-01-06 14:16:42 -05:00
test(function osPid() {
console.log("pid", Deno.pid);
assert(Deno.pid > 0);
2019-01-06 14:16:42 -05:00
});
2019-02-02 22:05:30 -05:00
// See complete tests in tools/is_tty_test.py
test(function osIsTTYSmoke() {
console.log(Deno.isTTY());
2019-02-02 22:05:30 -05:00
});