Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9797969

Browse filesBrowse files
Fishrock123evanlucas
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 <cjihrig@gmail.com>
1 parent 37dc795 commit 9797969
Copy full SHA for 9797969

File tree

Expand file treeCollapse file tree

4 files changed

+10
-25
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+10
-25
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/pseudo-tty/test-tty-stdout-end.js
-1Lines changed: 0 additions & 1 deletion
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

Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Collapse file

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

Copy file name to clipboard
+7-24Lines changed: 7 additions & 24 deletions
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.from('hello world\n'));
17-
req1.oncomplete = function() {
18-
callbacks++;
19-
};
20-
21-
var req2 = handle.writeBuffer(Buffer.from('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'));
Collapse file

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

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.