diff options
Diffstat (limited to 'test/pseudo-tty/test-tty-wrap.js')
-rw-r--r-- | test/pseudo-tty/test-tty-wrap.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/pseudo-tty/test-tty-wrap.js b/test/pseudo-tty/test-tty-wrap.js new file mode 100644 index 0000000000..fce4e194a8 --- /dev/null +++ b/test/pseudo-tty/test-tty-wrap.js @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); +var assert = require('assert'); + +var TTY = process.binding('tty_wrap').TTY; +var isTTY = process.binding('tty_wrap').isTTY; + +if (isTTY(1) == false) { + common.skip('fd 1 is not a tty.'); + return; +} + +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); +}); |