Skip to content

Commit cd9e8e0

Browse files
Fishrock123MylesBorins
authored andcommitted
test: fix old tty tests
test-tty-wrap hasn’t worked since StreamBase was introduced, I think. test-tty-stdout-end also happens to works with PipeWrap-s. Refs: #7360 PR-URL: #7613 Reviewed-By: Colin Ihrig <[email protected]>
1 parent 22990d8 commit cd9e8e0

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

test/pseudo-tty/test-tty-stdout-end.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict';
2-
// Can't test this when 'make test' doesn't assign a tty to the stdout.
32
require('../common');
43
const assert = require('assert');
54

test/pseudo-tty/test-tty-stdout-end.out

Whitespace-only changes.

test/pseudo-tty/test-tty-wrap.js

+7-24
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
11
'use strict';
2-
const common = require('../common');
3-
var assert = require('assert');
2+
require('../common');
43

5-
var TTY = process.binding('tty_wrap').TTY;
6-
var isTTY = process.binding('tty_wrap').isTTY;
4+
const TTY = process.binding('tty_wrap').TTY;
5+
const WriteWrap = process.binding('stream_wrap').WriteWrap;
76

8-
if (isTTY(1) == false) {
9-
common.skip('fd 1 is not a tty.');
10-
return;
11-
}
7+
const handle = new TTY(1);
8+
const req = new WriteWrap();
129

13-
var handle = new TTY(1);
14-
var callbacks = 0;
15-
16-
var req1 = handle.writeBuffer(Buffer('hello world\n'));
17-
req1.oncomplete = function() {
18-
callbacks++;
19-
};
20-
21-
var req2 = handle.writeBuffer(Buffer('hello world\n'));
22-
req2.oncomplete = function() {
23-
callbacks++;
24-
};
25-
26-
process.on('exit', function() {
27-
assert.equal(2, callbacks);
28-
});
10+
handle.writeBuffer(req, Buffer.from('hello world 1\n'));
11+
handle.writeBuffer(req, Buffer.from('hello world 2\n'));

test/pseudo-tty/test-tty-wrap.out

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hello world 1
2+
hello world 2

0 commit comments

Comments
 (0)