Browse Source

test: use string instead of RegExp in split()

PR-URL: https://github.com/nodejs/node/pull/13710
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
v6.x
Vse Mozhet Byt 8 years ago
committed by Myles Borins
parent
commit
5a9d7b3bf5
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 2
      test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js
  2. 2
      test/parallel/test-repl-setprompt.js
  3. 2
      test/parallel/test-stdin-script-child.js

2
test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js

@ -24,7 +24,7 @@ for (const enc of ['utf8', 'utf16le', 'latin1', 'UTF-8']) {
const headerEnd = received.indexOf('\r\n\r\n', 'utf8'); const headerEnd = received.indexOf('\r\n\r\n', 'utf8');
assert.notStrictEqual(headerEnd, -1); assert.notStrictEqual(headerEnd, -1);
const header = received.toString('utf8', 0, headerEnd).split(/\r\n/); const header = received.toString('utf8', 0, headerEnd).split('\r\n');
const body = received.toString(enc, headerEnd + 4); const body = received.toString(enc, headerEnd + 4);
assert.strictEqual(header[0], 'HTTP/1.1 200 OK'); assert.strictEqual(header[0], 'HTTP/1.1 200 OK');

2
test/parallel/test-repl-setprompt.js

@ -23,6 +23,6 @@ child.stdin.end(`e.setPrompt("${p}");${os.EOL}`);
child.on('close', function(code, signal) { child.on('close', function(code, signal) {
assert.strictEqual(code, 0); assert.strictEqual(code, 0);
assert.ok(!signal); assert.ok(!signal);
const lines = data.split(/\n/); const lines = data.split('\n');
assert.strictEqual(lines.pop(), p); assert.strictEqual(lines.pop(), p);
}); });

2
test/parallel/test-stdin-script-child.js

@ -18,7 +18,7 @@ child.stdout.on('data', function(c) {
child.stderr.setEncoding('utf8'); child.stderr.setEncoding('utf8');
child.stderr.on('data', function(c) { child.stderr.on('data', function(c) {
console.error(`> ${c.trim().split(/\n/).join('\n> ')}`); console.error(`> ${c.trim().split('\n').join('\n> ')}`);
}); });
child.on('close', common.mustCall(function(c) { child.on('close', common.mustCall(function(c) {

Loading…
Cancel
Save