From 23acece30540a9832569c02787ff3593d20344c8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Apr 2016 21:21:12 -0700 Subject: [PATCH 1/4] lib,test,tools: alignment on variable assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correct alignment on variable assignments that span multiple lines in preparation for lint rule to enforce such alignment. PR-URL: https://github.com/nodejs/node/pull/6869 Reviewed-By: Ben Noordhuis Reviewed-By: Johan Bergström Reviewed-By: James M Snell Reviewed-By: Myles Borins --- lib/child_process.js | 7 ++- lib/repl.js | 4 +- lib/util.js | 9 ++- lib/zlib.js | 4 +- test/parallel/test-buffer.js | 40 ++++++------ test/parallel/test-cluster-worker-exit.js | 2 +- test/parallel/test-cluster-worker-kill.js | 2 +- ...main-no-error-handler-abort-on-uncaught.js | 4 +- test/parallel/test-error-reporting.js | 2 +- test/parallel/test-fs-append-file-sync.js | 12 ++-- test/parallel/test-http-1.0.js | 32 +++++----- test/parallel/test-path.js | 1 - .../test-readline-undefined-columns.js | 4 +- test/parallel/test-stdin-from-file.js | 2 +- test/parallel/test-tls-cert-regression.js | 43 +++++++------ test/parallel/test-tls-econnreset.js | 63 ++++++++++--------- test/parallel/test-tls-parse-cert-string.js | 6 +- test/parallel/test-vm-static-this.js | 4 +- test/parallel/test-zlib-from-string.js | 47 +++++++------- test/parallel/test-zlib.js | 6 +- test/sequential/test-vm-timeout-rethrow.js | 4 +- tools/doc/type-parser.js | 4 +- 22 files changed, 158 insertions(+), 144 deletions(-) diff --git a/lib/child_process.js b/lib/child_process.js index ddbb0448d90c20..dda613afdeeec6 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -458,9 +458,10 @@ function checkExecSyncError(ret) { ret.error = null; if (!err) { - var msg = 'Command failed: ' + - (ret.cmd ? ret.cmd : ret.args.join(' ')) + - (ret.stderr ? '\n' + ret.stderr.toString() : ''); + var msg = 'Command failed: '; + msg += ret.cmd || ret.args.join(' '); + if (ret.stderr) + msg += '\n' + ret.stderr.toString(); err = new Error(msg); } diff --git a/lib/repl.js b/lib/repl.js index bff367929ff0a3..71377b1cc7582d 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -70,8 +70,8 @@ exports._builtinLibs = ['assert', 'buffer', 'child_process', 'cluster', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib']; -const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, ' + - 'const, function, class) not yet supported outside strict mode'; +const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, const, function, ' + + 'class) not yet supported outside strict mode'; class LineParser { diff --git a/lib/util.js b/lib/util.js index 8cebbaa07516c2..c370d9509e1ca3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -426,9 +426,12 @@ function formatPrimitive(ctx, value) { var type = typeof value; if (type === 'string') { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; + var simple = '\'' + + JSON.stringify(value) + .replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + + '\''; return ctx.stylize(simple, 'string'); } if (type === 'number') { diff --git a/lib/zlib.js b/lib/zlib.js index 8cced1f88ff79d..6715ff11604920 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -6,8 +6,8 @@ const binding = process.binding('zlib'); const util = require('util'); const assert = require('assert').ok; const kMaxLength = require('buffer').kMaxLength; -const kRangeErrorMessage = 'Cannot create final Buffer. ' + - 'It would be larger than 0x' + kMaxLength.toString(16) + ' bytes.'; +const kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + + 'than 0x' + kMaxLength.toString(16) + ' bytes.'; // zlib doesn't provide these, so kludge them in following the same // const naming scheme zlib uses. diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js index 99d1c129ca8805..b62df2cf76992f 100644 --- a/test/parallel/test-buffer.js +++ b/test/parallel/test-buffer.js @@ -464,17 +464,17 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64')); { // big example const quote = 'Man is distinguished, not only by his reason, but by this ' + - 'singular passion from other animals, which is a lust ' + - 'of the mind, that by a perseverance of delight in the ' + - 'continued and indefatigable generation of knowledge, exceeds ' + - 'the short vehemence of any carnal pleasure.'; + 'singular passion from other animals, which is a lust ' + + 'of the mind, that by a perseverance of delight in the ' + + 'continued and indefatigable generation of knowledge, ' + + 'exceeds the short vehemence of any carnal pleasure.'; const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' + - '24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' + - 'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' + - 'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' + - 'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' + - 'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' + - 'c3VyZS4='; + '24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' + + 'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' + + 'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' + + 'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' + + 'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' + + '5hbCBwbGVhc3VyZS4='; assert.equal(expected, (new Buffer(quote)).toString('base64')); let b = new Buffer(1024); @@ -484,11 +484,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64')); // 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'; + 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 = new Buffer(1024); bytesWritten = b.write(expectedWhite, 0, 'base64'); assert.equal(quote.length, bytesWritten); @@ -502,11 +502,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64')); // check that the base64 decoder ignores illegal chars const expectedIllegal = expected.slice(0, 60) + ' \x80' + - expected.slice(60, 120) + ' \xff' + - expected.slice(120, 180) + ' \x00' + - expected.slice(180, 240) + ' \x98' + - expected.slice(240, 300) + '\x03' + - expected.slice(300, 360); + expected.slice(60, 120) + ' \xff' + + expected.slice(120, 180) + ' \x00' + + expected.slice(180, 240) + ' \x98' + + expected.slice(240, 300) + '\x03' + + expected.slice(300, 360); b = new Buffer(expectedIllegal, 'base64'); assert.equal(quote.length, b.length); assert.equal(quote, b.toString('ascii', 0, quote.length)); diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js index ccb213f0df9601..60c80ec938555d 100644 --- a/test/parallel/test-cluster-worker-exit.js +++ b/test/parallel/test-cluster-worker-exit.js @@ -107,7 +107,7 @@ function checkResults(expected_results, results) { const expected = expected_results[k]; var msg = (expected[1] || '') + - (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); + (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); if (expected && expected.length) { assert.equal(actual, expected[0], msg); diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index 1f44c93488b1e6..7c2465f9a463d1 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -90,7 +90,7 @@ function checkResults(expected_results, results) { const expected = expected_results[k]; var msg = (expected[1] || '') + - (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); + (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); if (expected && expected.length) { assert.equal(actual, expected[0], msg); } else { diff --git a/test/parallel/test-domain-no-error-handler-abort-on-uncaught.js b/test/parallel/test-domain-no-error-handler-abort-on-uncaught.js index 1ed7b1ee636e06..9fedba4ee6c541 100644 --- a/test/parallel/test-domain-no-error-handler-abort-on-uncaught.js +++ b/test/parallel/test-domain-no-error-handler-abort-on-uncaught.js @@ -182,8 +182,8 @@ if (process.argv[2] === 'child') { child.on('exit', function onExit(exitCode, signal) { const errMsg = 'Test at index ' + testIndex + ' should have aborted ' + - 'but instead exited with exit code ' + exitCode + ' and signal ' + - signal; + 'but instead exited with exit code ' + exitCode + + ' and signal ' + signal; assert(common.nodeProcessAborted(exitCode, signal), errMsg); }); }); diff --git a/test/parallel/test-error-reporting.js b/test/parallel/test-error-reporting.js index b5b70eeb3b2add..567642d3e83e2b 100644 --- a/test/parallel/test-error-reporting.js +++ b/test/parallel/test-error-reporting.js @@ -8,7 +8,7 @@ var exits = 0; function errExec(script, callback) { var cmd = '"' + process.argv[0] + '" "' + - path.join(common.fixturesDir, script) + '"'; + path.join(common.fixturesDir, script) + '"'; return exec(cmd, function(err, stdout, stderr) { // There was some error assert.ok(err); diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index 42e0790e1f7227..78cfaecaf5225c 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -8,12 +8,12 @@ var currentFileData = 'ABCD'; var num = 220; var data = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + - '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + - '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + - '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + - '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + - '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + - '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; + '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + + '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + + '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + + '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + + '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + + '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; common.refreshTmpDir(); diff --git a/test/parallel/test-http-1.0.js b/test/parallel/test-http-1.0.js index b4cb62534c4f6e..facf5c98eacb83 100644 --- a/test/parallel/test-http-1.0.js +++ b/test/parallel/test-http-1.0.js @@ -88,11 +88,11 @@ function test(handler, request_generator, response_validator) { } function response_validator(server_response, client_got_eof, timed_out) { - var expected_response = ('HTTP/1.1 200 OK\r\n' + - 'Content-Type: text/plain\r\n' + - 'Connection: close\r\n' + - '\r\n' + - 'Hello, world!'); + var expected_response = 'HTTP/1.1 200 OK\r\n' + + 'Content-Type: text/plain\r\n' + + 'Connection: close\r\n' + + '\r\n' + + 'Hello, world!'; assert.equal(expected_response, server_response); assert.equal(true, client_got_eof); @@ -125,17 +125,17 @@ function test(handler, request_generator, response_validator) { } function response_validator(server_response, client_got_eof, timed_out) { - var expected_response = ('HTTP/1.1 200 OK\r\n' + - 'Content-Type: text/plain\r\n' + - 'Connection: close\r\n' + - 'Transfer-Encoding: chunked\r\n' + - '\r\n' + - '7\r\n' + - 'Hello, \r\n' + - '6\r\n' + - 'world!\r\n' + - '0\r\n' + - '\r\n'); + var expected_response = 'HTTP/1.1 200 OK\r\n' + + 'Content-Type: text/plain\r\n' + + 'Connection: close\r\n' + + 'Transfer-Encoding: chunked\r\n' + + '\r\n' + + '7\r\n' + + 'Hello, \r\n' + + '6\r\n' + + 'world!\r\n' + + '0\r\n' + + '\r\n'; assert.equal(expected_response, server_response); assert.equal(true, client_got_eof); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 1432cb63a10ae4..a2c6f2a3e3792e 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -76,7 +76,6 @@ assert.equal(path.win32.dirname('\\\\unc\\share\\foo\\bar\\'), assert.equal(path.win32.dirname('\\\\unc\\share\\foo\\bar\\baz'), '\\\\unc\\share\\foo\\bar'); - assert.equal(path.extname(''), ''); assert.equal(path.extname('/path/to/file'), ''); assert.equal(path.extname('/path/to/file.ext'), '.ext'); diff --git a/test/parallel/test-readline-undefined-columns.js b/test/parallel/test-readline-undefined-columns.js index 24f138f46bce11..f3197ff59a9a55 100644 --- a/test/parallel/test-readline-undefined-columns.js +++ b/test/parallel/test-readline-undefined-columns.js @@ -28,8 +28,8 @@ oStream.on('data', function(data) { oStream.on('end', function() { const expect = 'process.stdout\r\n' + - 'process.stdin\r\n' + - 'process.stderr'; + 'process.stdin\r\n' + + 'process.stderr'; assert(new RegExp(expect).test(output)); }); diff --git a/test/parallel/test-stdin-from-file.js b/test/parallel/test-stdin-from-file.js index 862405b5d9b71a..d6e3afeae6fdee 100644 --- a/test/parallel/test-stdin-from-file.js +++ b/test/parallel/test-stdin-from-file.js @@ -9,7 +9,7 @@ var stdoutScript = join(common.fixturesDir, 'echo-close-check.js'); var tmpFile = join(common.tmpDir, 'stdin.txt'); var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' + - tmpFile + '"'; + tmpFile + '"'; var string = 'abc\nümlaut.\nsomething else\n' + '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' + diff --git a/test/parallel/test-tls-cert-regression.js b/test/parallel/test-tls-cert-regression.js index 6e546600b68f6c..4406e53ab0f616 100644 --- a/test/parallel/test-tls-cert-regression.js +++ b/test/parallel/test-tls-cert-regression.js @@ -9,26 +9,29 @@ if (!common.hasCrypto) { var tls = require('tls'); -var cert = '-----BEGIN CERTIFICATE-----\n' + - 'MIIBfjCCASgCCQDmmNjAojbDQjANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB\n' + - 'VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0\n' + - 'cyBQdHkgTHRkMCAXDTE0MDExNjE3NTMxM1oYDzIyODcxMDMxMTc1MzEzWjBFMQsw\n' + - 'CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu\n' + - 'ZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAPKwlfMX\n' + - '6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+wsU1O9FzRIVmpeIjDXhbp\n' + - 'Mjsa1HtzSiccPXsCAwEAATANBgkqhkiG9w0BAQUFAANBAHOoKy0NkyfiYH7Ne5ka\n' + - 'uvCyndyeB4d24FlfqEUlkfaWCZlNKRaV9YhLDiEg3BcIreFo4brtKQfZzTRs0GVm\n' + - 'KHg=\n' + - '-----END CERTIFICATE-----'; -var key = '-----BEGIN RSA PRIVATE KEY-----\n' + - 'MIIBPQIBAAJBAPKwlfMX6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+w\n' + - 'sU1O9FzRIVmpeIjDXhbpMjsa1HtzSiccPXsCAwEAAQJBAM4uU9aJE0OfdE1p/X+K\n' + - 'LrCT3XMdFCJ24GgmHyOURtwDy18upQJecDVdcZp16fjtOPmaW95GoYRyifB3R4I5\n' + - 'RxECIQD7jRM9slCSVV8xp9kOJQNpHjhRQYVGBn+pyllS2sb+RQIhAPb7Y+BIccri\n' + - 'NWnuhwCW8hA7Fkj/kaBdAwyW7L3Tvui/AiEAiqLCovMecre4Yi6GcsQ1b/6mvSmm\n' + - 'IOS+AT6zIfXPTB0CIQCJKGR3ymN/Qw5crL1GQ41cHCQtF9ickOq/lBUW+j976wIh\n' + - 'AOaJnkQrmurlRdePX6LvN/LgGAQoxwovfjcOYNnZsIVY\n' + - '-----END RSA PRIVATE KEY-----'; +var cert = +`-----BEGIN CERTIFICATE----- +MIIBfjCCASgCCQDmmNjAojbDQjANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB +VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMCAXDTE0MDExNjE3NTMxM1oYDzIyODcxMDMxMTc1MzEzWjBFMQsw +CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu +ZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAPKwlfMX +6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+wsU1O9FzRIVmpeIjDXhbp +Mjsa1HtzSiccPXsCAwEAATANBgkqhkiG9w0BAQUFAANBAHOoKy0NkyfiYH7Ne5ka +uvCyndyeB4d24FlfqEUlkfaWCZlNKRaV9YhLDiEg3BcIreFo4brtKQfZzTRs0GVm +KHg= +-----END CERTIFICATE-----`; + +var key = +`-----BEGIN RSA PRIVATE KEY----- +MIIBPQIBAAJBAPKwlfMX6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+w +sU1O9FzRIVmpeIjDXhbpMjsa1HtzSiccPXsCAwEAAQJBAM4uU9aJE0OfdE1p/X+K +LrCT3XMdFCJ24GgmHyOURtwDy18upQJecDVdcZp16fjtOPmaW95GoYRyifB3R4I5 +RxECIQD7jRM9slCSVV8xp9kOJQNpHjhRQYVGBn+pyllS2sb+RQIhAPb7Y+BIccri +NWnuhwCW8hA7Fkj/kaBdAwyW7L3Tvui/AiEAiqLCovMecre4Yi6GcsQ1b/6mvSmm +IOS+AT6zIfXPTB0CIQCJKGR3ymN/Qw5crL1GQ41cHCQtF9ickOq/lBUW+j976wIh +AOaJnkQrmurlRdePX6LvN/LgGAQoxwovfjcOYNnZsIVY +-----END RSA PRIVATE KEY-----`; function test(cert, key, cb) { var server = tls.createServer({ diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index 6ef629a159a948..d60d3852a8aa51 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -8,38 +8,41 @@ if (!common.hasCrypto) { } var tls = require('tls'); -var cacert = '-----BEGIN CERTIFICATE-----\n' + - 'MIIBxTCCAX8CAnXnMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD\n' + - 'VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n\n' + - 'TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv\n' + - 'bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMH0xCzAJ\n' + - 'BgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZ\n' + - 'MBcGA1UEChMQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRow\n' + - 'GAYDVQQDExFjYS5zdHJvbmdsb29wLmNvbTBMMA0GCSqGSIb3DQEBAQUAAzsAMDgC\n' + - 'MQDKbQ6rIR5t1q1v4Ha36jrq0IkyUohy9EYNvLnXUly1PGqxby0ILlAVJ8JawpY9\n' + - 'AVkCAwEAATANBgkqhkiG9w0BAQUFAAMxALA1uS4CqQXRSAyYTfio5oyLGz71a+NM\n' + - '+0AFLBwh5AQjhGd0FcenU4OfHxyDEOJT/Q==\n' + - '-----END CERTIFICATE-----\n'; +var cacert = +`-----BEGIN CERTIFICATE----- +MIIBxTCCAX8CAnXnMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD +VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n +TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv +bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMH0xCzAJ +BgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZ +MBcGA1UEChMQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRow +GAYDVQQDExFjYS5zdHJvbmdsb29wLmNvbTBMMA0GCSqGSIb3DQEBAQUAAzsAMDgC +MQDKbQ6rIR5t1q1v4Ha36jrq0IkyUohy9EYNvLnXUly1PGqxby0ILlAVJ8JawpY9 +AVkCAwEAATANBgkqhkiG9w0BAQUFAAMxALA1uS4CqQXRSAyYTfio5oyLGz71a+NM ++0AFLBwh5AQjhGd0FcenU4OfHxyDEOJT/Q== +-----END CERTIFICATE-----`; -var cert = '-----BEGIN CERTIFICATE-----\n' + - 'MIIBfDCCATYCAgQaMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD\n' + - 'VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n\n' + - 'TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv\n' + - 'bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMBkxFzAV\n' + - 'BgNVBAMTDnN0cm9uZ2xvb3AuY29tMEwwDQYJKoZIhvcNAQEBBQADOwAwOAIxAMfk\n' + - 'I0LWU15pPUwIQNMnRVhhOibi0TQmAau8FBtgwEfGK01WpfGUaJr1a41K8Uq7xwID\n' + - 'AQABoxkwFzAVBgNVHREEDjAMhwQAAAAAhwR/AAABMA0GCSqGSIb3DQEBBQUAAzEA\n' + - 'cGpYrhkrb7mIh9DNhV0qp7pGjqBzlHqB7KQXw2luLDp//6dyHBMexDCQznkhZKRU\n' + - '-----END CERTIFICATE-----\n'; +var cert = +`-----BEGIN CERTIFICATE----- +MIIBfDCCATYCAgQaMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD +VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n +TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv +bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMBkxFzAV +BgNVBAMTDnN0cm9uZ2xvb3AuY29tMEwwDQYJKoZIhvcNAQEBBQADOwAwOAIxAMfk +I0LWU15pPUwIQNMnRVhhOibi0TQmAau8FBtgwEfGK01WpfGUaJr1a41K8Uq7xwID +AQABoxkwFzAVBgNVHREEDjAMhwQAAAAAhwR/AAABMA0GCSqGSIb3DQEBBQUAAzEA +cGpYrhkrb7mIh9DNhV0qp7pGjqBzlHqB7KQXw2luLDp//6dyHBMexDCQznkhZKRU +-----END CERTIFICATE-----`; -var key = '-----BEGIN RSA PRIVATE KEY-----\n' + - 'MIH0AgEAAjEAx+QjQtZTXmk9TAhA0ydFWGE6JuLRNCYBq7wUG2DAR8YrTVal8ZRo\n' + - 'mvVrjUrxSrvHAgMBAAECMBCGccvSwC2r8Z9Zh1JtirQVxaL1WWpAQfmVwLe0bAgg\n' + - '/JWMU/6hS36TsYyZMxwswQIZAPTAfht/zDLb7Hwgu2twsS1Ra9w/yyvtlwIZANET\n' + - '26votwJAHK1yUrZGA5nnp5qcmQ/JUQIZAII5YV/UUZvF9D/fUplJ7puENPWNY9bN\n' + - 'pQIZAMMwxuS3XiO7two2sQF6W+JTYyX1DPCwAQIZAOYg1TvEGT38k8e8jygv8E8w\n' + - 'YqrWTeQFNQ==\n' + - '-----END RSA PRIVATE KEY-----\n'; +var key = +`-----BEGIN RSA PRIVATE KEY----- +MIH0AgEAAjEAx+QjQtZTXmk9TAhA0ydFWGE6JuLRNCYBq7wUG2DAR8YrTVal8ZRo +mvVrjUrxSrvHAgMBAAECMBCGccvSwC2r8Z9Zh1JtirQVxaL1WWpAQfmVwLe0bAgg +/JWMU/6hS36TsYyZMxwswQIZAPTAfht/zDLb7Hwgu2twsS1Ra9w/yyvtlwIZANET +26votwJAHK1yUrZGA5nnp5qcmQ/JUQIZAII5YV/UUZvF9D/fUplJ7puENPWNY9bN +pQIZAMMwxuS3XiO7two2sQF6W+JTYyX1DPCwAQIZAOYg1TvEGT38k8e8jygv8E8w +YqrWTeQFNQ== +-----END RSA PRIVATE KEY-----`; var ca = [ cert, cacert ]; diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js index 11128783871fe4..6607d6974c95b3 100644 --- a/test/parallel/test-tls-parse-cert-string.js +++ b/test/parallel/test-tls-parse-cert-string.js @@ -4,8 +4,8 @@ require('../common'); const assert = require('assert'); const tls = require('tls'); -const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\nCN=ca1\n' - + 'emailAddress=ry@clouds.org'; +const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\n' + + 'CN=ca1\nemailAddress=ry@clouds.org'; const singlesOut = tls.parseCertString(singles); assert.deepEqual(singlesOut, { C: 'US', @@ -18,7 +18,7 @@ assert.deepEqual(singlesOut, { }); const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' + - 'CN=*.nodejs.org'; + 'CN=*.nodejs.org'; const doublesOut = tls.parseCertString(doubles); assert.deepEqual(doublesOut, { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], diff --git a/test/parallel/test-vm-static-this.js b/test/parallel/test-vm-static-this.js index 143e4e12216d5e..a3cf2d820c3423 100644 --- a/test/parallel/test-vm-static-this.js +++ b/test/parallel/test-vm-static-this.js @@ -21,8 +21,8 @@ assert.equal(2, global.hello); console.error('pass values'); var code = 'foo = 1;' + - 'bar = 2;' + - 'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');'; + 'bar = 2;' + + 'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');'; global.foo = 2; global.obj = { foo: 0, baz: 3 }; /* eslint-disable no-unused-vars */ diff --git a/test/parallel/test-zlib-from-string.js b/test/parallel/test-zlib-from-string.js index 14c747fc433692..1c9f0eb012d261 100644 --- a/test/parallel/test-zlib-from-string.js +++ b/test/parallel/test-zlib-from-string.js @@ -5,27 +5,32 @@ require('../common'); var assert = require('assert'); var zlib = require('zlib'); -var inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing el' + - 'it. Morbi faucibus, purus at gravida dictum, libero arcu convallis la' + - 'cus, in commodo libero metus eu nisi. Nullam commodo, neque nec porta' + - ' placerat, nisi est fermentum augue, vitae gravida tellus sapien sit ' + - 'amet tellus. Aenean non diam orci. Proin quis elit turpis. Suspendiss' + - 'e non diam ipsum. Suspendisse nec ullamcorper odio. Vestibulum arcu m' + - 'i, sodales non suscipit id, ultrices ut massa. Sed ac sem sit amet ar' + - 'cu malesuada fermentum. Nunc sed. '; -var expectedBase64Deflate = 'eJxdUUtOQzEMvMoc4OndgT0gJCT2buJWlpI4jePeqZfpm' + - 'XAKLRKbLOzx/HK73q6vOrhCunlF1qIDJhNUeW5I2ozT5OkDlKWLJWkncJG5403HQXAkT3' + - 'Jw29B9uIEmToMukglZ0vS6ociBh4JG8sV4oVLEUCitK2kxq1WzPnChHDzsaGKy491Lofo' + - 'AbWh8do43oeuYhB5EPCjcLjzYJo48KrfQBvnJecNFJvHT1+RSQsGoC7dn2t/xjhduTA1N' + - 'WyQIZR0pbHwMDatnD+crPqKSqGPHp1vnlsWM/07ubf7bheF7kqSj84Bm0R1fYTfaK8vqq' + - 'qfKBtNMhe3OZh6N95CTvMX5HJJi4xOVzCgUOIMSLH7wmeOHaFE4RdpnGavKtrB5xzfO/Ll9'; -var expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN' + - '496pl+mZcAotEpss7PH8crverq86uEK6eUXWogMmE1R5bkjajNPk6QOUpYslaSdwkbnjT' + - 'cdBcCRPcnDb0H24gSZOgy6SCVnS9LqhyIGHgkbyxXihUsRQKK0raTGrVbM+cKEcPOxoYr' + - 'Lj3Uuh+gBtaHx2jjeh65iEHkQ8KNwuPNgmjjwqt9AG+cl5w0Um8dPX5FJCwagLt2fa3/G' + - 'OF25MDU1bJAhlHSlsfAwNq2cP5ys+opKoY8enW+eWxYz/Tu5t/tuF4XuSpKPzgGbRHV9h' + - 'N9ory+qqp8oG00yF7c5mHo33kJO8xfkckmLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2s' + - 'HnHNzRtagj5AQAA'; +var inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing elit.' + + ' Morbi faucibus, purus at gravida dictum, libero arcu conv' + + 'allis lacus, in commodo libero metus eu nisi. Nullam commo' + + 'do, neque nec porta placerat, nisi est fermentum augue, vi' + + 'tae gravida tellus sapien sit amet tellus. Aenean non diam' + + ' orci. Proin quis elit turpis. Suspendisse non diam ipsum.' + + ' Suspendisse nec ullamcorper odio. Vestibulum arcu mi, sod' + + 'ales non suscipit id, ultrices ut massa. Sed ac sem sit am' + + 'et arcu malesuada fermentum. Nunc sed. '; +var expectedBase64Deflate = 'eJxdUUtOQzEMvMoc4OndgT0gJCT2buJWlpI4jePeqZfpmXAK' + + 'LRKbLOzx/HK73q6vOrhCunlF1qIDJhNUeW5I2ozT5OkDlKWL' + + 'JWkncJG5403HQXAkT3Jw29B9uIEmToMukglZ0vS6ociBh4JG' + + '8sV4oVLEUCitK2kxq1WzPnChHDzsaGKy491LofoAbWh8do43' + + 'oeuYhB5EPCjcLjzYJo48KrfQBvnJecNFJvHT1+RSQsGoC7dn' + + '2t/xjhduTA1NWyQIZR0pbHwMDatnD+crPqKSqGPHp1vnlsWM' + + '/07ubf7bheF7kqSj84Bm0R1fYTfaK8vqqqfKBtNMhe3OZh6N' + + '95CTvMX5HJJi4xOVzCgUOIMSLH7wmeOHaFE4RdpnGavKtrB5' + + 'xzfO/Ll9'; +var expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN496' + + 'pl+mZcAotEpss7PH8crverq86uEK6eUXWogMmE1R5bkjajNPk6Q' + + 'OUpYslaSdwkbnjTcdBcCRPcnDb0H24gSZOgy6SCVnS9LqhyIGHg' + + 'kbyxXihUsRQKK0raTGrVbM+cKEcPOxoYrLj3Uuh+gBtaHx2jjeh' + + '65iEHkQ8KNwuPNgmjjwqt9AG+cl5w0Um8dPX5FJCwagLt2fa3/G' + + 'OF25MDU1bJAhlHSlsfAwNq2cP5ys+opKoY8enW+eWxYz/Tu5t/t' + + 'uF4XuSpKPzgGbRHV9hN9ory+qqp8oG00yF7c5mHo33kJO8xfkck' + + 'mLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2sHnHNzRtagj5AQAA'; zlib.deflate(inputString, function(err, buffer) { assert.equal(buffer.toString('base64'), expectedBase64Deflate, diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 305d28865d992b..caaa62c69ae70b 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -165,9 +165,9 @@ Object.keys(tests).forEach(function(file) { // verify that the same exact buffer comes out the other end. buf.on('data', function(c) { var msg = file + ' ' + - chunkSize + ' ' + - JSON.stringify(opts) + ' ' + - Def.name + ' -> ' + Inf.name; + chunkSize + ' ' + + JSON.stringify(opts) + ' ' + + Def.name + ' -> ' + Inf.name; var ok = true; var testNum = ++done; for (var i = 0; i < Math.max(c.length, test.length); i++) { diff --git a/test/sequential/test-vm-timeout-rethrow.js b/test/sequential/test-vm-timeout-rethrow.js index dd513b5a694de0..f0f9c0b9c51063 100644 --- a/test/sequential/test-vm-timeout-rethrow.js +++ b/test/sequential/test-vm-timeout-rethrow.js @@ -6,8 +6,8 @@ var spawn = require('child_process').spawn; if (process.argv[2] === 'child') { var code = 'var j = 0;\n' + - 'for (var i = 0; i < 1000000; i++) j += add(i, i + 1);\n' + - 'j;'; + 'for (var i = 0; i < 1000000; i++) j += add(i, i + 1);\n' + + 'j;'; var ctx = vm.createContext({ add: function(x, y) { diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 2e6c5bea919c19..a5698892b8e4f9 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -1,9 +1,9 @@ 'use strict'; const nodeDocUrl = ''; const jsDocUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/' + - 'Reference/Global_Objects/'; + 'Reference/Global_Objects/'; const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' + - 'JavaScript/Data_structures'; + 'JavaScript/Data_structures'; const jsPrimitives = [ 'Number', 'String', 'Boolean', 'Null', 'Symbol' ]; From 146364b3f29745bc7ab1cf66d62c7fec2cd43fe6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Apr 2016 21:22:12 -0700 Subject: [PATCH 2/4] tools: lint for alignment of variable assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enforce alignment/indentation on variable assignments that span multiple lines. PR-URL: https://github.com/nodejs/node/pull/6869 Reviewed-By: Ben Noordhuis Reviewed-By: Johan Bergström Reviewed-By: James M Snell Reviewed-By: Myles Borins --- .eslintrc | 4 +- .../align-multiline-assignment.js | 69 +++++++++++++++++++ 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tools/eslint-rules/align-multiline-assignment.js diff --git a/.eslintrc b/.eslintrc index 38d01df0778210..af0e6ddc15670f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,7 +13,7 @@ rules: no-duplicate-case: 2 no-empty-character-class: 2 no-ex-assign: 2 - no-extra-boolean-cast : 2 + no-extra-boolean-cast: 2 no-extra-parens: [2, "functions"] no-extra-semi: 2 no-func-assign: 2 @@ -87,7 +87,7 @@ rules: # Custom rules in tools/eslint-rules assert-fail-single-argument: 2 new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"] - + align-multiline-assignment: 2 # Global scoped method and vars globals: diff --git a/tools/eslint-rules/align-multiline-assignment.js b/tools/eslint-rules/align-multiline-assignment.js new file mode 100644 index 00000000000000..3e79c6f7cd4ac5 --- /dev/null +++ b/tools/eslint-rules/align-multiline-assignment.js @@ -0,0 +1,69 @@ +/** + * @fileoverview Align multiline variable assignments + * @author Rich Trott + */ +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +function getBinaryExpressionStarts(binaryExpression, starts) { + starts = starts || []; + function getStartsFromOneSide(side, starts) { + starts.push(side.loc.start); + if (side.type === 'BinaryExpression') { + starts = getBinaryExpressionStarts(side, starts); + } + return starts; + } + + starts = getStartsFromOneSide(binaryExpression.left, starts); + starts = getStartsFromOneSide(binaryExpression.right, starts); + return starts; +} + +function checkExpressionAlignment(expression) { + if (!expression) + return; + + var msg = ''; + + switch (expression.type) { + case 'BinaryExpression': + var starts = getBinaryExpressionStarts(expression); + var startLine = starts[0].line; + const startColumn = starts[0].column; + starts.forEach((loc) => { + if (loc.line > startLine) { + startLine = loc.line; + if (loc.column !== startColumn) { + msg = 'Misaligned multiline assignment'; + } + } + }); + break; + } + return msg; +} + +function testAssignment(context, node) { + const msg = checkExpressionAlignment(node.right); + if (msg) + context.report(node, msg); +} + +function testDecleration(context, node) { + node.declarations.forEach((declaration) => { + const msg = checkExpressionAlignment(declaration.init); + // const start = declaration.init.loc.start; + if (msg) + context.report(node, msg); + }); +} + +module.exports = function(context) { + return { + 'AssignmentExpression': (node) => testAssignment(context, node), + 'VariableDeclaration': (node) => testDecleration(context, node) + }; +}; From e04fa702c3e019463cde4c42576a0d5b671c1f85 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 20 May 2016 22:55:37 +0200 Subject: [PATCH 3/4] vm: don't abort process when stack space runs out Make less assumptions about what objects will be available when vm context creation or error message printing fail because V8 runs out of JS stack space. Ref: https://github.com/nodejs/node/issues/6899 --- src/node_contextify.cc | 6 +++++- test/parallel/test-vm-low-stack-space.js | 26 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-vm-low-stack-space.js diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 8235dcd49e093c..d50b4b568b5da5 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -205,7 +205,11 @@ class ContextifyContext { Local ctx = Context::New(env->isolate(), nullptr, object_template); - CHECK(!ctx.IsEmpty()); + if (ctx.IsEmpty()) { + env->ThrowError("Could not instantiate context"); + return Local(); + } + ctx->SetSecurityToken(env->context()->GetSecurityToken()); // We need to tie the lifetime of the sandbox object with the lifetime of diff --git a/test/parallel/test-vm-low-stack-space.js b/test/parallel/test-vm-low-stack-space.js new file mode 100644 index 00000000000000..7c1313d47c1ad9 --- /dev/null +++ b/test/parallel/test-vm-low-stack-space.js @@ -0,0 +1,26 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const vm = require('vm'); + +function a() { + try { + return a(); + } catch (e) { + // Throw an exception as near to the recursion-based RangeError as possible. + return vm.runInThisContext('() => 42')(); + } +} + +assert.strictEqual(a(), 42); + +function b() { + try { + return b(); + } catch (e) { + // This writes a lot of noise to stderr, but it still works. + return vm.runInNewContext('() => 42')(); + } +} + +assert.strictEqual(b(), 42); From 6b774f7116c794899eca5160fdb8aef58812ce1e Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 20 May 2016 23:11:27 +0200 Subject: [PATCH 4/4] module: don't cache uninitialized builtins Don't cache the exported values of fully uninitialized builtins. This works by adding an additional `loading` flag that is only active during initial loading of an internal module and checking that either the module is fully loaded or is in that state before using its cached value. This has the effect that builtins modules which could not be loaded (e.g. because compilation failed due to missing stack space) can be loaded at a later point. Fixes: https://github.com/nodejs/node/issues/6899 --- src/node.js | 20 +++++++++++++------- test/message/console_low_stack_space.js | 22 ++++++++++++++++++++++ test/message/console_low_stack_space.out | 1 + 3 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 test/message/console_low_stack_space.js create mode 100644 test/message/console_low_stack_space.out diff --git a/src/node.js b/src/node.js index 7301d9d114ed98..a4d86da6a93a69 100644 --- a/src/node.js +++ b/src/node.js @@ -877,6 +877,7 @@ this.id = id; this.exports = {}; this.loaded = false; + this.loading = true; } NativeModule._source = process.binding('natives'); @@ -888,7 +889,7 @@ } var cached = NativeModule.getCached(id); - if (cached) { + if (cached && (cached.loaded || cached.loading)) { return cached.exports; } @@ -952,13 +953,18 @@ var source = NativeModule.getSource(this.id); source = NativeModule.wrap(source); - var fn = runInThisContext(source, { - filename: this.filename, - lineOffset: 0 - }); - fn(this.exports, NativeModule.require, this, this.filename); + this.loading = true; + try { + var fn = runInThisContext(source, { + filename: this.filename, + lineOffset: 0 + }); + fn(this.exports, NativeModule.require, this, this.filename); - this.loaded = true; + this.loaded = true; + } finally { + this.loading = false; + } }; NativeModule.prototype.cache = function() { diff --git a/test/message/console_low_stack_space.js b/test/message/console_low_stack_space.js new file mode 100644 index 00000000000000..1685a35a1f9304 --- /dev/null +++ b/test/message/console_low_stack_space.js @@ -0,0 +1,22 @@ +'use strict'; +// copy console accessor because requiring ../common touches it +const consoleDescriptor = Object.getOwnPropertyDescriptor(global, 'console'); +delete global.console; +global.console = {}; + +require('../common'); + +function a() { + try { + return a(); + } catch (e) { + const console = consoleDescriptor.get(); + if (console.log) { + console.log('Hello, World!'); + } else { + throw e; + } + } +} + +a(); diff --git a/test/message/console_low_stack_space.out b/test/message/console_low_stack_space.out new file mode 100644 index 00000000000000..8ab686eafeb1f4 --- /dev/null +++ b/test/message/console_low_stack_space.out @@ -0,0 +1 @@ +Hello, World!