summaryrefslogtreecommitdiff
path: root/test/pseudo-tty/test-tty-wrap.js
diff options
context:
space:
mode:
authorJeremiah Senkpiel <fishrock123@rocketmail.com>2016-07-08 14:22:14 +0200
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-07-11 15:22:09 +0200
commitf3a38883076a3ffc227f062f0b80ff08ed5e79fe (patch)
tree33ffe42e51c45d52dfde37c8a11238e9d9ebf188 /test/pseudo-tty/test-tty-wrap.js
parent839f3d971612060ed18a67b051db9e51dfac377f (diff)
downloadandroid-node-v8-f3a38883076a3ffc227f062f0b80ff08ed5e79fe.tar.gz
android-node-v8-f3a38883076a3ffc227f062f0b80ff08ed5e79fe.tar.bz2
android-node-v8-f3a38883076a3ffc227f062f0b80ff08ed5e79fe.zip
test: move parallel/test-tty-* to pseudo-tty/
Refs: https://github.com/nodejs/node/pull/7360 PR-URL: https://github.com/nodejs/node/pull/7613 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/pseudo-tty/test-tty-wrap.js')
-rw-r--r--test/pseudo-tty/test-tty-wrap.js28
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);
+});