Skip to content

Commit

Permalink
test: fix old tty tests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fishrock123 committed Jul 11, 2016
1 parent f3a3888 commit aab3066
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
1 change: 0 additions & 1 deletion test/pseudo-tty/test-tty-stdout-end.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
// Can't test this when 'make test' doesn't assign a tty to the stdout.
require('../common');
const assert = require('assert');

Expand Down
1 change: 1 addition & 0 deletions test/pseudo-tty/test-tty-stdout-end.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

31 changes: 7 additions & 24 deletions test/pseudo-tty/test-tty-wrap.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
'use strict';
const common = require('../common');
var assert = require('assert');
require('../common');

var TTY = process.binding('tty_wrap').TTY;
var isTTY = process.binding('tty_wrap').isTTY;
const TTY = process.binding('tty_wrap').TTY;
const WriteWrap = process.binding('stream_wrap').WriteWrap;

if (isTTY(1) == false) {
common.skip('fd 1 is not a tty.');
return;
}
const handle = new TTY(1);
const req = new WriteWrap();

var handle = new TTY(1);
var callbacks = 0;

var req1 = handle.writeBuffer(Buffer.from('hello world\n'));
req1.oncomplete = function() {
callbacks++;
};

var req2 = handle.writeBuffer(Buffer.from('hello world\n'));
req2.oncomplete = function() {
callbacks++;
};

process.on('exit', function() {
assert.equal(2, callbacks);
});
handle.writeBuffer(req, Buffer.from('hello world 1\n'));
handle.writeBuffer(req, Buffer.from('hello world 2\n'));
2 changes: 2 additions & 0 deletions test/pseudo-tty/test-tty-wrap.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hello world 1
hello world 2

0 comments on commit aab3066

Please sign in to comment.