mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
ac33fc2892
Towards #22079
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
// deno-lint-ignore-file no-deprecated-deno-api
|
|
|
|
import { assert, DENO_FUTURE } from "./test_util.ts";
|
|
|
|
// Note tests for Deno.stdin.setRaw is in integration tests.
|
|
|
|
Deno.test(function consoleSize() {
|
|
if (!Deno.stdout.isTerminal()) {
|
|
return;
|
|
}
|
|
const result = Deno.consoleSize();
|
|
assert(typeof result.columns !== "undefined");
|
|
assert(typeof result.rows !== "undefined");
|
|
});
|
|
|
|
Deno.test(
|
|
{ ignore: DENO_FUTURE, permissions: { read: true } },
|
|
function isatty() {
|
|
// CI not under TTY, so cannot test stdin/stdout/stderr.
|
|
const f = Deno.openSync("tests/testdata/assets/hello.txt");
|
|
// @ts-ignore `Deno.isatty()` was soft-removed in Deno 2.
|
|
assert(!Deno.isatty(f.rid));
|
|
f.close();
|
|
},
|
|
);
|
|
|
|
Deno.test(function isattyError() {
|
|
let caught = false;
|
|
try {
|
|
// Absurdly large rid.
|
|
// @ts-ignore `Deno.isatty()` was soft-removed in Deno 2.
|
|
Deno.isatty(0x7fffffff);
|
|
} catch (e) {
|
|
caught = true;
|
|
assert(e instanceof Deno.errors.BadResource);
|
|
}
|
|
assert(caught);
|
|
});
|