From 28f858a80749a55ea7c4263ba2383f008f481e87 Mon Sep 17 00:00:00 2001 From: Jonathan Darling Date: Thu, 1 Dec 2016 11:49:50 -0600 Subject: [PATCH 1/2] test: add test for process.stdin.setRawMode() adds a basic test for process.stdin.setRawMode to ensure that the isRaw property is properly changed --- test/pseudo-tty/stdin-setrawmode.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/pseudo-tty/stdin-setrawmode.js diff --git a/test/pseudo-tty/stdin-setrawmode.js b/test/pseudo-tty/stdin-setrawmode.js new file mode 100644 index 00000000000000..629585ad78c255 --- /dev/null +++ b/test/pseudo-tty/stdin-setrawmode.js @@ -0,0 +1,9 @@ +'use strict'; +require('../common'); +const assert = require('assert'); + +process.stdin.setRawMode(true); +assert(process.stdin.isRaw); + +process.stdin.setRawMode(false); +assert(!process.stdin.isRaw); From f78822860de056dc9ea764f12d834258c7f2d51c Mon Sep 17 00:00:00 2001 From: Jonathan Darling Date: Thu, 1 Dec 2016 15:07:28 -0600 Subject: [PATCH 2/2] test: replace assert with assert.strictEqual Replaces usages of plain assert() with assert.strictEqual() to prevent issues with "truthiness" or "falsiness". --- test/pseudo-tty/stdin-setrawmode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pseudo-tty/stdin-setrawmode.js b/test/pseudo-tty/stdin-setrawmode.js index 629585ad78c255..015c769a9b6144 100644 --- a/test/pseudo-tty/stdin-setrawmode.js +++ b/test/pseudo-tty/stdin-setrawmode.js @@ -3,7 +3,7 @@ require('../common'); const assert = require('assert'); process.stdin.setRawMode(true); -assert(process.stdin.isRaw); +assert.strictEqual(process.stdin.isRaw, true); process.stdin.setRawMode(false); -assert(!process.stdin.isRaw); +assert.strictEqual(process.stdin.isRaw, false);