From 34e7486eeb3aaea5a5ad378cb8b2a61194efcde7 Mon Sep 17 00:00:00 2001 From: Braden Whitten Date: Fri, 6 Oct 2017 16:13:43 -0700 Subject: [PATCH 1/2] test: update test-buffer-alloc to use tpl literals Updated a single usage of string concatenation to use template literals. There are other usages of string concatenation in this file, but they are used to make test code more readable. --- test/parallel/test-buffer-alloc.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 2843e9c9db727a..c3535ad3ac6ae5 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -310,12 +310,12 @@ assert.strictEqual('TWFu', (Buffer.from('Man')).toString('base64')); assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); // check that the base64 decoder ignores whitespace - const expectedWhite = expected.slice(0, 60) + ' \n' + - expected.slice(60, 120) + ' \n' + - expected.slice(120, 180) + ' \n' + - expected.slice(180, 240) + ' \n' + - expected.slice(240, 300) + '\n' + - expected.slice(300, 360) + '\n'; + const expectedWhite = `${expected.slice(0, 60)} + ${expected.slice(60, 120)} + ${expected.slice(120, 180)} + ${expected.slice(180, 240)} + ${expected.slice(240, 300)} + ${expected.slice(300, 360)}`; b = Buffer.allocUnsafe(1024); bytesWritten = b.write(expectedWhite, 0, 'base64'); assert.strictEqual(quote.length, bytesWritten); From 1c6a7bedd8bc1195a13d7cc02c27b9c91625f6c1 Mon Sep 17 00:00:00 2001 From: Braden Whitten Date: Sun, 15 Oct 2017 23:47:34 -0400 Subject: [PATCH 2/2] keep test string exactly as it was --- test/parallel/test-buffer-alloc.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index c3535ad3ac6ae5..26923df0045a42 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -310,12 +310,12 @@ assert.strictEqual('TWFu', (Buffer.from('Man')).toString('base64')); assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); // check that the base64 decoder ignores whitespace - const expectedWhite = `${expected.slice(0, 60)} - ${expected.slice(60, 120)} - ${expected.slice(120, 180)} - ${expected.slice(180, 240)} - ${expected.slice(240, 300)} - ${expected.slice(300, 360)}`; + const expectedWhite = `${expected.slice(0, 60)} \n` + + `${expected.slice(60, 120)} \n` + + `${expected.slice(120, 180)} \n` + + `${expected.slice(180, 240)} \n` + + `${expected.slice(240, 300)}\n` + + `${expected.slice(300, 360)}\n`; b = Buffer.allocUnsafe(1024); bytesWritten = b.write(expectedWhite, 0, 'base64'); assert.strictEqual(quote.length, bytesWritten);