mirror of
https://github.com/denoland/deno.git
synced 2024-11-14 16:33:45 -05:00
68119e1d7e
All Deno runtime test files were moved to cli/js/tests/ directory. It makes a clear distinction that cli/js/tests/ contains code that is run under Deno runtime as opposed to code in cli/js/ which is used to create bundle and snapshot with "deno_typescript".
23 lines
640 B
TypeScript
23 lines
640 B
TypeScript
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
import { unitTest, assert } from "./test_util.ts";
|
|
|
|
// Note tests for Deno.setRaw is in integration tests.
|
|
|
|
unitTest({ perms: { read: true } }, function isatty(): void {
|
|
// CI not under TTY, so cannot test stdin/stdout/stderr.
|
|
const f = Deno.openSync("cli/tests/hello.txt");
|
|
assert(!Deno.isatty(f.rid));
|
|
f.close();
|
|
});
|
|
|
|
unitTest(function isattyError(): void {
|
|
let caught = false;
|
|
try {
|
|
// Absurdly large rid.
|
|
Deno.isatty(0x7fffffff);
|
|
} catch (e) {
|
|
caught = true;
|
|
assert(e instanceof Deno.errors.BadResource);
|
|
}
|
|
assert(caught);
|
|
});
|