diff options
author | Eric Schrock <Eric.Schrock@delphix.com> | 2013-05-20 14:44:26 -0400 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2013-09-23 14:22:37 -0700 |
commit | 35ae69682253ea51e59610a9a9e132c78f5e71d5 (patch) | |
tree | 24a3ba7bca10164da0ececd2222336af89dc2627 /test | |
parent | 7c554a5cd0f1420e5017ef57252b3d3c6496cea0 (diff) | |
download | nodejs-35ae69682253ea51e59610a9a9e132c78f5e71d5.tar.gz nodejs-35ae69682253ea51e59610a9a9e132c78f5e71d5.tar.bz2 nodejs-35ae69682253ea51e59610a9a9e132c78f5e71d5.zip |
readline: handle input starting with control chars
Handle control characters only when there is a single byte in the
stream, otherwise fall through to the standard multibyte handling.
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-readline-interface.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/simple/test-readline-interface.js b/test/simple/test-readline-interface.js index fc20d1d21..8976b8eb2 100644 --- a/test/simple/test-readline-interface.js +++ b/test/simple/test-readline-interface.js @@ -155,6 +155,18 @@ FakeInput.prototype.end = function() {}; assert.equal(callCount, expectedLines.length - 1); rli.close(); + // \r at start of input should output blank line + fi = new FakeInput(); + rli = new readline.Interface({ input: fi, output: fi, terminal: true }); + expectedLines = ['', 'foo' ]; + callCount = 0; + rli.on('line', function(line) { + assert.equal(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', '\rfoo\r'); + assert.equal(callCount, expectedLines.length); + rli.close(); // sending a multi-byte utf8 char over multiple writes var buf = Buffer('☮', 'utf8'); |