0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-04 01:44:26 -05:00
deno/js/os_test.ts
Ryan Dahl c42a9d7370
Upgrade deno_std (#1892)
A major API change was that asserts are imported from testing/asserts.ts
now rather than testing/mod.ts and assertEqual as renamed to
assertEquals to conform to what is most common in JavaScript.
2019-03-06 20:48:46 -05:00

33 lines
829 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);
env.test_var = "Hello World";
const newEnv = Deno.env();
assertEquals(env.test_var, newEnv.test_var);
});
test(function envFailure() {
let caughtError = false;
try {
const env = 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());
});