forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest-tty-isatty.js
18 lines (15 loc) · 905 Bytes
/
test-tty-isatty.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';
require('../common');
const { strictEqual } = require('assert');
const { isatty } = require('tty');
strictEqual(isatty(0), true, 'stdin reported to not be a tty, but it is');
strictEqual(isatty(1), true, 'stdout reported to not be a tty, but it is');
strictEqual(isatty(2), true, 'stderr reported to not be a tty, but it is');
strictEqual(isatty(-1), false, '-1 reported to be a tty, but it is not');
strictEqual(isatty(55555), false, '55555 reported to be a tty, but it is not');
strictEqual(isatty(2 ** 31), false, '2^31 reported to be a tty, but it is not');
strictEqual(isatty(1.1), false, '1.1 reported to be a tty, but it is not');
strictEqual(isatty('1'), false, '\'1\' reported to be a tty, but it is not');
strictEqual(isatty({}), false, '{} reported to be a tty, but it is not');
strictEqual(isatty(() => {}), false,
'() => {} reported to be a tty, but it is not');