mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
24 lines
522 B
JavaScript
24 lines
522 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const common = require('../common');
|
||
|
|
||
|
const assert = require('node:assert');
|
||
|
const readline = require('node:readline');
|
||
|
const { Readable } = require('node:stream');
|
||
|
|
||
|
|
||
|
const input = Readable.from((function*() {
|
||
|
yield 'a\nb';
|
||
|
yield '\r\n';
|
||
|
})());
|
||
|
const rl = readline.createInterface({ input, crlfDelay: Infinity });
|
||
|
let carriageReturns = 0;
|
||
|
|
||
|
rl.on('line', (line) => {
|
||
|
if (line.includes('\r')) carriageReturns++;
|
||
|
});
|
||
|
|
||
|
rl.on('close', common.mustCall(() => {
|
||
|
assert.strictEqual(carriageReturns, 0);
|
||
|
}));
|