mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/12761 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>v6
Anna Henningsen
8 years ago
1 changed files with 45 additions and 0 deletions
@ -0,0 +1,45 @@ |
|||||
|
'use strict'; |
||||
|
const common = require('../common'); |
||||
|
const { PassThrough } = require('stream'); |
||||
|
const readline = require('readline'); |
||||
|
const assert = require('assert'); |
||||
|
|
||||
|
{ |
||||
|
const input = new PassThrough(); |
||||
|
const rl = readline.createInterface({ |
||||
|
terminal: true, |
||||
|
input: input |
||||
|
}); |
||||
|
|
||||
|
rl.on('line', common.mustCall((data) => { |
||||
|
assert.strictEqual(data, 'abc'); |
||||
|
})); |
||||
|
|
||||
|
input.end('abc'); |
||||
|
} |
||||
|
|
||||
|
{ |
||||
|
const input = new PassThrough(); |
||||
|
const rl = readline.createInterface({ |
||||
|
terminal: true, |
||||
|
input: input |
||||
|
}); |
||||
|
|
||||
|
rl.on('line', common.mustNotCall('must not be called before newline')); |
||||
|
|
||||
|
input.write('abc'); |
||||
|
} |
||||
|
|
||||
|
{ |
||||
|
const input = new PassThrough(); |
||||
|
const rl = readline.createInterface({ |
||||
|
terminal: true, |
||||
|
input: input |
||||
|
}); |
||||
|
|
||||
|
rl.on('line', common.mustCall((data) => { |
||||
|
assert.strictEqual(data, 'abc'); |
||||
|
})); |
||||
|
|
||||
|
input.write('abc\n'); |
||||
|
} |
Loading…
Reference in new issue