Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use string instead of RegExp in split() when it is sufficient #13710

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ for (const enc of ['utf8', 'utf16le', 'latin1', 'UTF-8']) {
const headerEnd = received.indexOf('\r\n\r\n', 'utf8');
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);

assert.strictEqual(header[0], 'HTTP/1.1 200 OK');
2 changes: 1 addition & 1 deletion test/parallel/test-repl-setprompt.js
Original file line number Diff line number Diff line change
@@ -44,6 +44,6 @@ child.stdin.end(`e.setPrompt("${p}");${os.EOL}`);
child.on('close', function(code, signal) {
assert.strictEqual(code, 0);
assert.ok(!signal);
const lines = data.split(/\n/);
const lines = data.split('\n');
assert.strictEqual(lines.pop(), p);
});
2 changes: 1 addition & 1 deletion test/parallel/test-stdin-script-child.js
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ for (const args of [[], ['-']]) {

child.stderr.setEncoding('utf8');
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) {