mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
* Add `no-useless-concat: error` to .eslintrc.yaml. * Apply no-useless-concat rule to tests. PR-URL: https://github.com/nodejs/node/pull/12613 Backport-PR-URL: https://github.com/nodejs/node/pull/13056 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
26 lines
624 B
JavaScript
26 lines
624 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(function(socket) {
|
|
socket.pipe(socket);
|
|
}).listen(0, common.mustCall(function() {
|
|
const conn = net.connect(this.address().port);
|
|
let received = '';
|
|
|
|
conn.setEncoding('utf8');
|
|
conn.write('before');
|
|
conn.on('connect', function() {
|
|
conn.write(' after');
|
|
});
|
|
conn.on('data', function(buf) {
|
|
received += buf;
|
|
conn.end();
|
|
});
|
|
conn.on('end', common.mustCall(function() {
|
|
server.close();
|
|
assert.strictEqual(received, 'before after');
|
|
}));
|
|
}));
|