lib,test,tools: alignment on variable assignments
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/6242 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
c1d82ac2ff
commit
31600735f4
@ -463,9 +463,10 @@ function checkExecSyncError(ret) {
|
|||||||
ret.error = null;
|
ret.error = null;
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
var msg = 'Command failed: ' +
|
var msg = 'Command failed: ';
|
||||||
(ret.cmd ? ret.cmd : ret.args.join(' ')) +
|
msg += ret.cmd || ret.args.join(' ');
|
||||||
(ret.stderr ? '\n' + ret.stderr.toString() : '');
|
if (ret.stderr)
|
||||||
|
msg += '\n' + ret.stderr.toString();
|
||||||
err = new Error(msg);
|
err = new Error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ exports.writer = util.inspect;
|
|||||||
exports._builtinLibs = internalModule.builtinLibs;
|
exports._builtinLibs = internalModule.builtinLibs;
|
||||||
|
|
||||||
|
|
||||||
const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, ' +
|
const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, const, function, ' +
|
||||||
'const, function, class) not yet supported outside strict mode';
|
'class) not yet supported outside strict mode';
|
||||||
|
|
||||||
|
|
||||||
class LineParser {
|
class LineParser {
|
||||||
|
@ -497,9 +497,12 @@ function formatPrimitive(ctx, value) {
|
|||||||
var type = typeof value;
|
var type = typeof value;
|
||||||
|
|
||||||
if (type === 'string') {
|
if (type === 'string') {
|
||||||
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
var simple = '\'' +
|
||||||
.replace(/'/g, "\\'")
|
JSON.stringify(value)
|
||||||
.replace(/\\"/g, '"') + '\'';
|
.replace(/^"|"$/g, '')
|
||||||
|
.replace(/'/g, "\\'")
|
||||||
|
.replace(/\\"/g, '"') +
|
||||||
|
'\'';
|
||||||
return ctx.stylize(simple, 'string');
|
return ctx.stylize(simple, 'string');
|
||||||
}
|
}
|
||||||
if (type === 'number')
|
if (type === 'number')
|
||||||
|
@ -6,8 +6,8 @@ const binding = process.binding('zlib');
|
|||||||
const util = require('util');
|
const util = require('util');
|
||||||
const assert = require('assert').ok;
|
const assert = require('assert').ok;
|
||||||
const kMaxLength = require('buffer').kMaxLength;
|
const kMaxLength = require('buffer').kMaxLength;
|
||||||
const kRangeErrorMessage = 'Cannot create final Buffer. ' +
|
const kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' +
|
||||||
'It would be larger than 0x' + kMaxLength.toString(16) + ' bytes';
|
'than 0x' + kMaxLength.toString(16) + ' bytes';
|
||||||
|
|
||||||
// zlib doesn't provide these, so kludge them in following the same
|
// zlib doesn't provide these, so kludge them in following the same
|
||||||
// const naming scheme zlib uses.
|
// const naming scheme zlib uses.
|
||||||
|
@ -535,17 +535,17 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
|
|||||||
{
|
{
|
||||||
// big example
|
// big example
|
||||||
const quote = 'Man is distinguished, not only by his reason, but by this ' +
|
const quote = 'Man is distinguished, not only by his reason, but by this ' +
|
||||||
'singular passion from other animals, which is a lust ' +
|
'singular passion from other animals, which is a lust ' +
|
||||||
'of the mind, that by a perseverance of delight in the ' +
|
'of the mind, that by a perseverance of delight in the ' +
|
||||||
'continued and indefatigable generation of knowledge, exceeds ' +
|
'continued and indefatigable generation of knowledge, ' +
|
||||||
'the short vehemence of any carnal pleasure.';
|
'exceeds the short vehemence of any carnal pleasure.';
|
||||||
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
|
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
|
||||||
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' +
|
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' +
|
||||||
'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' +
|
'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' +
|
||||||
'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' +
|
'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' +
|
||||||
'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' +
|
'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' +
|
||||||
'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' +
|
'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' +
|
||||||
'c3VyZS4=';
|
'5hbCBwbGVhc3VyZS4=';
|
||||||
assert.equal(expected, (Buffer.from(quote)).toString('base64'));
|
assert.equal(expected, (Buffer.from(quote)).toString('base64'));
|
||||||
|
|
||||||
let b = Buffer.allocUnsafe(1024);
|
let b = Buffer.allocUnsafe(1024);
|
||||||
@ -555,11 +555,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
|
|||||||
|
|
||||||
// check that the base64 decoder ignores whitespace
|
// check that the base64 decoder ignores whitespace
|
||||||
const expectedWhite = expected.slice(0, 60) + ' \n' +
|
const expectedWhite = expected.slice(0, 60) + ' \n' +
|
||||||
expected.slice(60, 120) + ' \n' +
|
expected.slice(60, 120) + ' \n' +
|
||||||
expected.slice(120, 180) + ' \n' +
|
expected.slice(120, 180) + ' \n' +
|
||||||
expected.slice(180, 240) + ' \n' +
|
expected.slice(180, 240) + ' \n' +
|
||||||
expected.slice(240, 300) + '\n' +
|
expected.slice(240, 300) + '\n' +
|
||||||
expected.slice(300, 360) + '\n';
|
expected.slice(300, 360) + '\n';
|
||||||
b = Buffer.allocUnsafe(1024);
|
b = Buffer.allocUnsafe(1024);
|
||||||
bytesWritten = b.write(expectedWhite, 0, 'base64');
|
bytesWritten = b.write(expectedWhite, 0, 'base64');
|
||||||
assert.equal(quote.length, bytesWritten);
|
assert.equal(quote.length, bytesWritten);
|
||||||
@ -573,11 +573,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
|
|||||||
|
|
||||||
// check that the base64 decoder ignores illegal chars
|
// check that the base64 decoder ignores illegal chars
|
||||||
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
|
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
|
||||||
expected.slice(60, 120) + ' \xff' +
|
expected.slice(60, 120) + ' \xff' +
|
||||||
expected.slice(120, 180) + ' \x00' +
|
expected.slice(120, 180) + ' \x00' +
|
||||||
expected.slice(180, 240) + ' \x98' +
|
expected.slice(180, 240) + ' \x98' +
|
||||||
expected.slice(240, 300) + '\x03' +
|
expected.slice(240, 300) + '\x03' +
|
||||||
expected.slice(300, 360);
|
expected.slice(300, 360);
|
||||||
b = Buffer.from(expectedIllegal, 'base64');
|
b = Buffer.from(expectedIllegal, 'base64');
|
||||||
assert.equal(quote.length, b.length);
|
assert.equal(quote.length, b.length);
|
||||||
assert.equal(quote, b.toString('ascii', 0, quote.length));
|
assert.equal(quote, b.toString('ascii', 0, quote.length));
|
||||||
|
@ -533,17 +533,17 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
|
|||||||
{
|
{
|
||||||
// big example
|
// big example
|
||||||
const quote = 'Man is distinguished, not only by his reason, but by this ' +
|
const quote = 'Man is distinguished, not only by his reason, but by this ' +
|
||||||
'singular passion from other animals, which is a lust ' +
|
'singular passion from other animals, which is a lust ' +
|
||||||
'of the mind, that by a perseverance of delight in the ' +
|
'of the mind, that by a perseverance of delight in the ' +
|
||||||
'continued and indefatigable generation of knowledge, exceeds ' +
|
'continued and indefatigable generation of knowledge, ' +
|
||||||
'the short vehemence of any carnal pleasure.';
|
'exceeds the short vehemence of any carnal pleasure.';
|
||||||
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
|
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
|
||||||
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' +
|
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' +
|
||||||
'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' +
|
'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' +
|
||||||
'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' +
|
'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' +
|
||||||
'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' +
|
'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' +
|
||||||
'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' +
|
'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' +
|
||||||
'c3VyZS4=';
|
'5hbCBwbGVhc3VyZS4=';
|
||||||
assert.equal(expected, (new Buffer(quote)).toString('base64'));
|
assert.equal(expected, (new Buffer(quote)).toString('base64'));
|
||||||
|
|
||||||
let b = new Buffer(1024);
|
let b = new Buffer(1024);
|
||||||
@ -553,11 +553,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
|
|||||||
|
|
||||||
// check that the base64 decoder ignores whitespace
|
// check that the base64 decoder ignores whitespace
|
||||||
const expectedWhite = expected.slice(0, 60) + ' \n' +
|
const expectedWhite = expected.slice(0, 60) + ' \n' +
|
||||||
expected.slice(60, 120) + ' \n' +
|
expected.slice(60, 120) + ' \n' +
|
||||||
expected.slice(120, 180) + ' \n' +
|
expected.slice(120, 180) + ' \n' +
|
||||||
expected.slice(180, 240) + ' \n' +
|
expected.slice(180, 240) + ' \n' +
|
||||||
expected.slice(240, 300) + '\n' +
|
expected.slice(240, 300) + '\n' +
|
||||||
expected.slice(300, 360) + '\n';
|
expected.slice(300, 360) + '\n';
|
||||||
b = new Buffer(1024);
|
b = new Buffer(1024);
|
||||||
bytesWritten = b.write(expectedWhite, 0, 'base64');
|
bytesWritten = b.write(expectedWhite, 0, 'base64');
|
||||||
assert.equal(quote.length, bytesWritten);
|
assert.equal(quote.length, bytesWritten);
|
||||||
@ -571,11 +571,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
|
|||||||
|
|
||||||
// check that the base64 decoder ignores illegal chars
|
// check that the base64 decoder ignores illegal chars
|
||||||
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
|
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
|
||||||
expected.slice(60, 120) + ' \xff' +
|
expected.slice(60, 120) + ' \xff' +
|
||||||
expected.slice(120, 180) + ' \x00' +
|
expected.slice(120, 180) + ' \x00' +
|
||||||
expected.slice(180, 240) + ' \x98' +
|
expected.slice(180, 240) + ' \x98' +
|
||||||
expected.slice(240, 300) + '\x03' +
|
expected.slice(240, 300) + '\x03' +
|
||||||
expected.slice(300, 360);
|
expected.slice(300, 360);
|
||||||
b = new Buffer(expectedIllegal, 'base64');
|
b = new Buffer(expectedIllegal, 'base64');
|
||||||
assert.equal(quote.length, b.length);
|
assert.equal(quote.length, b.length);
|
||||||
assert.equal(quote, b.toString('ascii', 0, quote.length));
|
assert.equal(quote, b.toString('ascii', 0, quote.length));
|
||||||
|
@ -107,7 +107,7 @@ function checkResults(expected_results, results) {
|
|||||||
const expected = expected_results[k];
|
const expected = expected_results[k];
|
||||||
|
|
||||||
var msg = (expected[1] || '') +
|
var msg = (expected[1] || '') +
|
||||||
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
||||||
|
|
||||||
if (expected && expected.length) {
|
if (expected && expected.length) {
|
||||||
assert.equal(actual, expected[0], msg);
|
assert.equal(actual, expected[0], msg);
|
||||||
|
@ -90,7 +90,7 @@ function checkResults(expected_results, results) {
|
|||||||
const expected = expected_results[k];
|
const expected = expected_results[k];
|
||||||
|
|
||||||
var msg = (expected[1] || '') +
|
var msg = (expected[1] || '') +
|
||||||
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
||||||
if (expected && expected.length) {
|
if (expected && expected.length) {
|
||||||
assert.equal(actual, expected[0], msg);
|
assert.equal(actual, expected[0], msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,8 +160,8 @@ if (process.argv[2] === 'child') {
|
|||||||
|
|
||||||
child.on('exit', function onExit(exitCode, signal) {
|
child.on('exit', function onExit(exitCode, signal) {
|
||||||
const errMsg = 'Test at index ' + testIndex + ' should have aborted ' +
|
const errMsg = 'Test at index ' + testIndex + ' should have aborted ' +
|
||||||
'but instead exited with exit code ' + exitCode + ' and signal ' +
|
'but instead exited with exit code ' + exitCode +
|
||||||
signal;
|
' and signal ' + signal;
|
||||||
assert(common.nodeProcessAborted(exitCode, signal), errMsg);
|
assert(common.nodeProcessAborted(exitCode, signal), errMsg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ var exits = 0;
|
|||||||
|
|
||||||
function errExec(script, callback) {
|
function errExec(script, callback) {
|
||||||
var cmd = '"' + process.argv[0] + '" "' +
|
var cmd = '"' + process.argv[0] + '" "' +
|
||||||
path.join(common.fixturesDir, script) + '"';
|
path.join(common.fixturesDir, script) + '"';
|
||||||
return exec(cmd, function(err, stdout, stderr) {
|
return exec(cmd, function(err, stdout, stderr) {
|
||||||
// There was some error
|
// There was some error
|
||||||
assert.ok(err);
|
assert.ok(err);
|
||||||
|
@ -8,12 +8,12 @@ var currentFileData = 'ABCD';
|
|||||||
|
|
||||||
var num = 220;
|
var num = 220;
|
||||||
var data = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' +
|
var data = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' +
|
||||||
'广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' +
|
'广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' +
|
||||||
'南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' +
|
'南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' +
|
||||||
'前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' +
|
'前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' +
|
||||||
'南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' +
|
'南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' +
|
||||||
'历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' +
|
'历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' +
|
||||||
'它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n';
|
'它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n';
|
||||||
|
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@ function test(handler, request_generator, response_validator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function response_validator(server_response, client_got_eof, timed_out) {
|
function response_validator(server_response, client_got_eof, timed_out) {
|
||||||
var expected_response = ('HTTP/1.1 200 OK\r\n' +
|
var expected_response = 'HTTP/1.1 200 OK\r\n' +
|
||||||
'Content-Type: text/plain\r\n' +
|
'Content-Type: text/plain\r\n' +
|
||||||
'Connection: close\r\n' +
|
'Connection: close\r\n' +
|
||||||
'\r\n' +
|
'\r\n' +
|
||||||
'Hello, world!');
|
'Hello, world!';
|
||||||
|
|
||||||
assert.equal(expected_response, server_response);
|
assert.equal(expected_response, server_response);
|
||||||
assert.equal(true, client_got_eof);
|
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) {
|
function response_validator(server_response, client_got_eof, timed_out) {
|
||||||
var expected_response = ('HTTP/1.1 200 OK\r\n' +
|
var expected_response = 'HTTP/1.1 200 OK\r\n' +
|
||||||
'Content-Type: text/plain\r\n' +
|
'Content-Type: text/plain\r\n' +
|
||||||
'Connection: close\r\n' +
|
'Connection: close\r\n' +
|
||||||
'Transfer-Encoding: chunked\r\n' +
|
'Transfer-Encoding: chunked\r\n' +
|
||||||
'\r\n' +
|
'\r\n' +
|
||||||
'7\r\n' +
|
'7\r\n' +
|
||||||
'Hello, \r\n' +
|
'Hello, \r\n' +
|
||||||
'6\r\n' +
|
'6\r\n' +
|
||||||
'world!\r\n' +
|
'world!\r\n' +
|
||||||
'0\r\n' +
|
'0\r\n' +
|
||||||
'\r\n');
|
'\r\n';
|
||||||
|
|
||||||
assert.equal(expected_response, server_response);
|
assert.equal(expected_response, server_response);
|
||||||
assert.equal(true, client_got_eof);
|
assert.equal(true, client_got_eof);
|
||||||
|
@ -128,12 +128,11 @@ const trailingTests = [
|
|||||||
const failures = [];
|
const failures = [];
|
||||||
trailingTests.forEach(function(test) {
|
trailingTests.forEach(function(test) {
|
||||||
const parse = test[0];
|
const parse = test[0];
|
||||||
|
const os = parse === path.win32.parse ? 'win32' : 'posix';
|
||||||
test[1].forEach(function(test) {
|
test[1].forEach(function(test) {
|
||||||
const actual = parse(test[0]);
|
const actual = parse(test[0]);
|
||||||
const expected = test[1];
|
const expected = test[1];
|
||||||
const fn = 'path.' +
|
const fn = `path.${os}.parse(`;
|
||||||
(parse === path.win32.parse ? 'win32' : 'posix') +
|
|
||||||
'.parse(';
|
|
||||||
const message = fn +
|
const message = fn +
|
||||||
JSON.stringify(test[0]) +
|
JSON.stringify(test[0]) +
|
||||||
')' +
|
')' +
|
||||||
|
@ -155,13 +155,16 @@ assert.throws(path.win32.dirname.bind(null, {}), TypeError);
|
|||||||
].forEach(function(test) {
|
].forEach(function(test) {
|
||||||
[path.posix.extname, path.win32.extname].forEach(function(extname) {
|
[path.posix.extname, path.win32.extname].forEach(function(extname) {
|
||||||
let input = test[0];
|
let input = test[0];
|
||||||
if (extname === path.win32.extname)
|
let os;
|
||||||
|
if (extname === path.win32.extname) {
|
||||||
input = input.replace(/\//g, '\\');
|
input = input.replace(/\//g, '\\');
|
||||||
|
os = 'win32';
|
||||||
|
} else {
|
||||||
|
os = 'posix';
|
||||||
|
}
|
||||||
const actual = extname(input);
|
const actual = extname(input);
|
||||||
const expected = test[1];
|
const expected = test[1];
|
||||||
const fn = 'path.' +
|
const fn = `path.${os}.extname(`;
|
||||||
(extname === path.win32.extname ? 'win32' : 'posix') +
|
|
||||||
'.extname(';
|
|
||||||
const message = fn + JSON.stringify(input) + ')' +
|
const message = fn + JSON.stringify(input) + ')' +
|
||||||
'\n expect=' + JSON.stringify(expected) +
|
'\n expect=' + JSON.stringify(expected) +
|
||||||
'\n actual=' + JSON.stringify(actual);
|
'\n actual=' + JSON.stringify(actual);
|
||||||
@ -319,11 +322,15 @@ joinTests.forEach(function(test) {
|
|||||||
// For non-Windows specific tests with the Windows join(), we need to try
|
// For non-Windows specific tests with the Windows join(), we need to try
|
||||||
// replacing the slashes since the non-Windows specific tests' `expected`
|
// replacing the slashes since the non-Windows specific tests' `expected`
|
||||||
// use forward slashes
|
// use forward slashes
|
||||||
const actualAlt = (join === path.win32.join) ?
|
let actualAlt;
|
||||||
actual.replace(/\\/g, '/') : undefined;
|
let os;
|
||||||
const fn = 'path.' +
|
if (join === path.win32.join) {
|
||||||
(join === path.win32.join ? 'win32' : 'posix') +
|
actualAlt = actual.replace(/\\/g, '/');
|
||||||
'.join(';
|
os = 'win32';
|
||||||
|
} else {
|
||||||
|
os = 'posix';
|
||||||
|
}
|
||||||
|
const fn = `path.${os}.join(`;
|
||||||
const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
|
const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
|
||||||
'\n expect=' + JSON.stringify(expected) +
|
'\n expect=' + JSON.stringify(expected) +
|
||||||
'\n actual=' + JSON.stringify(actual);
|
'\n actual=' + JSON.stringify(actual);
|
||||||
@ -423,14 +430,14 @@ resolveTests.forEach(function(test) {
|
|||||||
test[1].forEach(function(test) {
|
test[1].forEach(function(test) {
|
||||||
const actual = resolve.apply(null, test[0]);
|
const actual = resolve.apply(null, test[0]);
|
||||||
let actualAlt;
|
let actualAlt;
|
||||||
|
const os = resolve === path.win32.resolve ? 'win32' : 'posix';
|
||||||
if (resolve === path.win32.resolve && !common.isWindows)
|
if (resolve === path.win32.resolve && !common.isWindows)
|
||||||
actualAlt = actual.replace(/\\/g, '/');
|
actualAlt = actual.replace(/\\/g, '/');
|
||||||
else if (resolve !== path.win32.resolve && common.isWindows)
|
else if (resolve !== path.win32.resolve && common.isWindows)
|
||||||
actualAlt = actual.replace(/\//g, '\\');
|
actualAlt = actual.replace(/\//g, '\\');
|
||||||
|
|
||||||
const expected = test[1];
|
const expected = test[1];
|
||||||
const fn = 'path.' +
|
const fn = `path.${os}.resolve(`;
|
||||||
(resolve === path.win32.resolve ? 'win32' : 'posix') +
|
|
||||||
'.resolve(';
|
|
||||||
const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
|
const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
|
||||||
'\n expect=' + JSON.stringify(expected) +
|
'\n expect=' + JSON.stringify(expected) +
|
||||||
'\n actual=' + JSON.stringify(actual);
|
'\n actual=' + JSON.stringify(actual);
|
||||||
@ -517,9 +524,8 @@ relativeTests.forEach(function(test) {
|
|||||||
test[1].forEach(function(test) {
|
test[1].forEach(function(test) {
|
||||||
const actual = relative(test[0], test[1]);
|
const actual = relative(test[0], test[1]);
|
||||||
const expected = test[2];
|
const expected = test[2];
|
||||||
const fn = 'path.' +
|
const os = relative === path.win32.relative ? 'win32' : 'posix';
|
||||||
(relative === path.win32.relative ? 'win32' : 'posix') +
|
const fn = `path.${os}.relative(`;
|
||||||
'.relative(';
|
|
||||||
const message = fn +
|
const message = fn +
|
||||||
test.slice(0, 2).map(JSON.stringify).join(',') +
|
test.slice(0, 2).map(JSON.stringify).join(',') +
|
||||||
')' +
|
')' +
|
||||||
|
@ -28,8 +28,8 @@ oStream.on('data', function(data) {
|
|||||||
|
|
||||||
oStream.on('end', function() {
|
oStream.on('end', function() {
|
||||||
const expect = 'process.stdout\r\n' +
|
const expect = 'process.stdout\r\n' +
|
||||||
'process.stdin\r\n' +
|
'process.stdin\r\n' +
|
||||||
'process.stderr';
|
'process.stderr';
|
||||||
assert(new RegExp(expect).test(output));
|
assert(new RegExp(expect).test(output));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -9,26 +9,29 @@ if (!common.hasCrypto) {
|
|||||||
var tls = require('tls');
|
var tls = require('tls');
|
||||||
|
|
||||||
|
|
||||||
var cert = '-----BEGIN CERTIFICATE-----\n' +
|
var cert =
|
||||||
'MIIBfjCCASgCCQDmmNjAojbDQjANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB\n' +
|
`-----BEGIN CERTIFICATE-----
|
||||||
'VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0\n' +
|
MIIBfjCCASgCCQDmmNjAojbDQjANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB
|
||||||
'cyBQdHkgTHRkMCAXDTE0MDExNjE3NTMxM1oYDzIyODcxMDMxMTc1MzEzWjBFMQsw\n' +
|
VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0
|
||||||
'CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu\n' +
|
cyBQdHkgTHRkMCAXDTE0MDExNjE3NTMxM1oYDzIyODcxMDMxMTc1MzEzWjBFMQsw
|
||||||
'ZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAPKwlfMX\n' +
|
CQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJu
|
||||||
'6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+wsU1O9FzRIVmpeIjDXhbp\n' +
|
ZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAPKwlfMX
|
||||||
'Mjsa1HtzSiccPXsCAwEAATANBgkqhkiG9w0BAQUFAANBAHOoKy0NkyfiYH7Ne5ka\n' +
|
6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+wsU1O9FzRIVmpeIjDXhbp
|
||||||
'uvCyndyeB4d24FlfqEUlkfaWCZlNKRaV9YhLDiEg3BcIreFo4brtKQfZzTRs0GVm\n' +
|
Mjsa1HtzSiccPXsCAwEAATANBgkqhkiG9w0BAQUFAANBAHOoKy0NkyfiYH7Ne5ka
|
||||||
'KHg=\n' +
|
uvCyndyeB4d24FlfqEUlkfaWCZlNKRaV9YhLDiEg3BcIreFo4brtKQfZzTRs0GVm
|
||||||
'-----END CERTIFICATE-----';
|
KHg=
|
||||||
var key = '-----BEGIN RSA PRIVATE KEY-----\n' +
|
-----END CERTIFICATE-----`;
|
||||||
'MIIBPQIBAAJBAPKwlfMX6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+w\n' +
|
|
||||||
'sU1O9FzRIVmpeIjDXhbpMjsa1HtzSiccPXsCAwEAAQJBAM4uU9aJE0OfdE1p/X+K\n' +
|
var key =
|
||||||
'LrCT3XMdFCJ24GgmHyOURtwDy18upQJecDVdcZp16fjtOPmaW95GoYRyifB3R4I5\n' +
|
`-----BEGIN RSA PRIVATE KEY-----
|
||||||
'RxECIQD7jRM9slCSVV8xp9kOJQNpHjhRQYVGBn+pyllS2sb+RQIhAPb7Y+BIccri\n' +
|
MIIBPQIBAAJBAPKwlfMX6HGZIt1xm7fna72eWcOYfUfSxSugghvqYgJt2Oi3lH+w
|
||||||
'NWnuhwCW8hA7Fkj/kaBdAwyW7L3Tvui/AiEAiqLCovMecre4Yi6GcsQ1b/6mvSmm\n' +
|
sU1O9FzRIVmpeIjDXhbpMjsa1HtzSiccPXsCAwEAAQJBAM4uU9aJE0OfdE1p/X+K
|
||||||
'IOS+AT6zIfXPTB0CIQCJKGR3ymN/Qw5crL1GQ41cHCQtF9ickOq/lBUW+j976wIh\n' +
|
LrCT3XMdFCJ24GgmHyOURtwDy18upQJecDVdcZp16fjtOPmaW95GoYRyifB3R4I5
|
||||||
'AOaJnkQrmurlRdePX6LvN/LgGAQoxwovfjcOYNnZsIVY\n' +
|
RxECIQD7jRM9slCSVV8xp9kOJQNpHjhRQYVGBn+pyllS2sb+RQIhAPb7Y+BIccri
|
||||||
'-----END RSA PRIVATE KEY-----';
|
NWnuhwCW8hA7Fkj/kaBdAwyW7L3Tvui/AiEAiqLCovMecre4Yi6GcsQ1b/6mvSmm
|
||||||
|
IOS+AT6zIfXPTB0CIQCJKGR3ymN/Qw5crL1GQ41cHCQtF9ickOq/lBUW+j976wIh
|
||||||
|
AOaJnkQrmurlRdePX6LvN/LgGAQoxwovfjcOYNnZsIVY
|
||||||
|
-----END RSA PRIVATE KEY-----`;
|
||||||
|
|
||||||
function test(cert, key, cb) {
|
function test(cert, key, cb) {
|
||||||
var server = tls.createServer({
|
var server = tls.createServer({
|
||||||
|
@ -8,38 +8,41 @@ if (!common.hasCrypto) {
|
|||||||
}
|
}
|
||||||
var tls = require('tls');
|
var tls = require('tls');
|
||||||
|
|
||||||
var cacert = '-----BEGIN CERTIFICATE-----\n' +
|
var cacert =
|
||||||
'MIIBxTCCAX8CAnXnMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD\n' +
|
`-----BEGIN CERTIFICATE-----
|
||||||
'VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n\n' +
|
MIIBxTCCAX8CAnXnMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD
|
||||||
'TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv\n' +
|
VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n
|
||||||
'bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMH0xCzAJ\n' +
|
TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv
|
||||||
'BgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZ\n' +
|
bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMH0xCzAJ
|
||||||
'MBcGA1UEChMQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRow\n' +
|
BgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZ
|
||||||
'GAYDVQQDExFjYS5zdHJvbmdsb29wLmNvbTBMMA0GCSqGSIb3DQEBAQUAAzsAMDgC\n' +
|
MBcGA1UEChMQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRow
|
||||||
'MQDKbQ6rIR5t1q1v4Ha36jrq0IkyUohy9EYNvLnXUly1PGqxby0ILlAVJ8JawpY9\n' +
|
GAYDVQQDExFjYS5zdHJvbmdsb29wLmNvbTBMMA0GCSqGSIb3DQEBAQUAAzsAMDgC
|
||||||
'AVkCAwEAATANBgkqhkiG9w0BAQUFAAMxALA1uS4CqQXRSAyYTfio5oyLGz71a+NM\n' +
|
MQDKbQ6rIR5t1q1v4Ha36jrq0IkyUohy9EYNvLnXUly1PGqxby0ILlAVJ8JawpY9
|
||||||
'+0AFLBwh5AQjhGd0FcenU4OfHxyDEOJT/Q==\n' +
|
AVkCAwEAATANBgkqhkiG9w0BAQUFAAMxALA1uS4CqQXRSAyYTfio5oyLGz71a+NM
|
||||||
'-----END CERTIFICATE-----\n';
|
+0AFLBwh5AQjhGd0FcenU4OfHxyDEOJT/Q==
|
||||||
|
-----END CERTIFICATE-----`;
|
||||||
|
|
||||||
var cert = '-----BEGIN CERTIFICATE-----\n' +
|
var cert =
|
||||||
'MIIBfDCCATYCAgQaMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD\n' +
|
`-----BEGIN CERTIFICATE-----
|
||||||
'VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n\n' +
|
MIIBfDCCATYCAgQaMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD
|
||||||
'TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv\n' +
|
VQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQU3Ryb25n
|
||||||
'bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMBkxFzAV\n' +
|
TG9vcCwgSW5jLjESMBAGA1UECxMJU3Ryb25nT3BzMRowGAYDVQQDExFjYS5zdHJv
|
||||||
'BgNVBAMTDnN0cm9uZ2xvb3AuY29tMEwwDQYJKoZIhvcNAQEBBQADOwAwOAIxAMfk\n' +
|
bmdsb29wLmNvbTAeFw0xNDAxMTcyMjE1MDdaFw00MTA2MDMyMjE1MDdaMBkxFzAV
|
||||||
'I0LWU15pPUwIQNMnRVhhOibi0TQmAau8FBtgwEfGK01WpfGUaJr1a41K8Uq7xwID\n' +
|
BgNVBAMTDnN0cm9uZ2xvb3AuY29tMEwwDQYJKoZIhvcNAQEBBQADOwAwOAIxAMfk
|
||||||
'AQABoxkwFzAVBgNVHREEDjAMhwQAAAAAhwR/AAABMA0GCSqGSIb3DQEBBQUAAzEA\n' +
|
I0LWU15pPUwIQNMnRVhhOibi0TQmAau8FBtgwEfGK01WpfGUaJr1a41K8Uq7xwID
|
||||||
'cGpYrhkrb7mIh9DNhV0qp7pGjqBzlHqB7KQXw2luLDp//6dyHBMexDCQznkhZKRU\n' +
|
AQABoxkwFzAVBgNVHREEDjAMhwQAAAAAhwR/AAABMA0GCSqGSIb3DQEBBQUAAzEA
|
||||||
'-----END CERTIFICATE-----\n';
|
cGpYrhkrb7mIh9DNhV0qp7pGjqBzlHqB7KQXw2luLDp//6dyHBMexDCQznkhZKRU
|
||||||
|
-----END CERTIFICATE-----`;
|
||||||
|
|
||||||
var key = '-----BEGIN RSA PRIVATE KEY-----\n' +
|
var key =
|
||||||
'MIH0AgEAAjEAx+QjQtZTXmk9TAhA0ydFWGE6JuLRNCYBq7wUG2DAR8YrTVal8ZRo\n' +
|
`-----BEGIN RSA PRIVATE KEY-----
|
||||||
'mvVrjUrxSrvHAgMBAAECMBCGccvSwC2r8Z9Zh1JtirQVxaL1WWpAQfmVwLe0bAgg\n' +
|
MIH0AgEAAjEAx+QjQtZTXmk9TAhA0ydFWGE6JuLRNCYBq7wUG2DAR8YrTVal8ZRo
|
||||||
'/JWMU/6hS36TsYyZMxwswQIZAPTAfht/zDLb7Hwgu2twsS1Ra9w/yyvtlwIZANET\n' +
|
mvVrjUrxSrvHAgMBAAECMBCGccvSwC2r8Z9Zh1JtirQVxaL1WWpAQfmVwLe0bAgg
|
||||||
'26votwJAHK1yUrZGA5nnp5qcmQ/JUQIZAII5YV/UUZvF9D/fUplJ7puENPWNY9bN\n' +
|
/JWMU/6hS36TsYyZMxwswQIZAPTAfht/zDLb7Hwgu2twsS1Ra9w/yyvtlwIZANET
|
||||||
'pQIZAMMwxuS3XiO7two2sQF6W+JTYyX1DPCwAQIZAOYg1TvEGT38k8e8jygv8E8w\n' +
|
26votwJAHK1yUrZGA5nnp5qcmQ/JUQIZAII5YV/UUZvF9D/fUplJ7puENPWNY9bN
|
||||||
'YqrWTeQFNQ==\n' +
|
pQIZAMMwxuS3XiO7two2sQF6W+JTYyX1DPCwAQIZAOYg1TvEGT38k8e8jygv8E8w
|
||||||
'-----END RSA PRIVATE KEY-----\n';
|
YqrWTeQFNQ==
|
||||||
|
-----END RSA PRIVATE KEY-----`;
|
||||||
|
|
||||||
var ca = [ cert, cacert ];
|
var ca = [ cert, cacert ];
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
|
|
||||||
const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\nCN=ca1\n'
|
const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\n' +
|
||||||
+ 'emailAddress=ry@clouds.org';
|
'CN=ca1\nemailAddress=ry@clouds.org';
|
||||||
const singlesOut = tls.parseCertString(singles);
|
const singlesOut = tls.parseCertString(singles);
|
||||||
assert.deepEqual(singlesOut, {
|
assert.deepEqual(singlesOut, {
|
||||||
C: 'US',
|
C: 'US',
|
||||||
@ -18,7 +18,7 @@ assert.deepEqual(singlesOut, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' +
|
const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' +
|
||||||
'CN=*.nodejs.org';
|
'CN=*.nodejs.org';
|
||||||
const doublesOut = tls.parseCertString(doubles);
|
const doublesOut = tls.parseCertString(doubles);
|
||||||
assert.deepEqual(doublesOut, {
|
assert.deepEqual(doublesOut, {
|
||||||
OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ],
|
OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ],
|
||||||
|
@ -21,8 +21,8 @@ assert.equal(2, global.hello);
|
|||||||
|
|
||||||
console.error('pass values');
|
console.error('pass values');
|
||||||
var code = 'foo = 1;' +
|
var code = 'foo = 1;' +
|
||||||
'bar = 2;' +
|
'bar = 2;' +
|
||||||
'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');';
|
'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');';
|
||||||
global.foo = 2;
|
global.foo = 2;
|
||||||
global.obj = { foo: 0, baz: 3 };
|
global.obj = { foo: 0, baz: 3 };
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
@ -5,27 +5,32 @@ require('../common');
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var zlib = require('zlib');
|
var zlib = require('zlib');
|
||||||
|
|
||||||
var inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing el' +
|
var inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing elit.' +
|
||||||
'it. Morbi faucibus, purus at gravida dictum, libero arcu convallis la' +
|
' Morbi faucibus, purus at gravida dictum, libero arcu conv' +
|
||||||
'cus, in commodo libero metus eu nisi. Nullam commodo, neque nec porta' +
|
'allis lacus, in commodo libero metus eu nisi. Nullam commo' +
|
||||||
' placerat, nisi est fermentum augue, vitae gravida tellus sapien sit ' +
|
'do, neque nec porta placerat, nisi est fermentum augue, vi' +
|
||||||
'amet tellus. Aenean non diam orci. Proin quis elit turpis. Suspendiss' +
|
'tae gravida tellus sapien sit amet tellus. Aenean non diam' +
|
||||||
'e non diam ipsum. Suspendisse nec ullamcorper odio. Vestibulum arcu m' +
|
' orci. Proin quis elit turpis. Suspendisse non diam ipsum.' +
|
||||||
'i, sodales non suscipit id, ultrices ut massa. Sed ac sem sit amet ar' +
|
' Suspendisse nec ullamcorper odio. Vestibulum arcu mi, sod' +
|
||||||
'cu malesuada fermentum. Nunc sed. ';
|
'ales non suscipit id, ultrices ut massa. Sed ac sem sit am' +
|
||||||
var expectedBase64Deflate = 'eJxdUUtOQzEMvMoc4OndgT0gJCT2buJWlpI4jePeqZfpm' +
|
'et arcu malesuada fermentum. Nunc sed. ';
|
||||||
'XAKLRKbLOzx/HK73q6vOrhCunlF1qIDJhNUeW5I2ozT5OkDlKWLJWkncJG5403HQXAkT3' +
|
var expectedBase64Deflate = 'eJxdUUtOQzEMvMoc4OndgT0gJCT2buJWlpI4jePeqZfpmXAK' +
|
||||||
'Jw29B9uIEmToMukglZ0vS6ociBh4JG8sV4oVLEUCitK2kxq1WzPnChHDzsaGKy491Lofo' +
|
'LRKbLOzx/HK73q6vOrhCunlF1qIDJhNUeW5I2ozT5OkDlKWL' +
|
||||||
'AbWh8do43oeuYhB5EPCjcLjzYJo48KrfQBvnJecNFJvHT1+RSQsGoC7dn2t/xjhduTA1N' +
|
'JWkncJG5403HQXAkT3Jw29B9uIEmToMukglZ0vS6ociBh4JG' +
|
||||||
'WyQIZR0pbHwMDatnD+crPqKSqGPHp1vnlsWM/07ubf7bheF7kqSj84Bm0R1fYTfaK8vqq' +
|
'8sV4oVLEUCitK2kxq1WzPnChHDzsaGKy491LofoAbWh8do43' +
|
||||||
'qfKBtNMhe3OZh6N95CTvMX5HJJi4xOVzCgUOIMSLH7wmeOHaFE4RdpnGavKtrB5xzfO/Ll9';
|
'oeuYhB5EPCjcLjzYJo48KrfQBvnJecNFJvHT1+RSQsGoC7dn' +
|
||||||
var expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN' +
|
'2t/xjhduTA1NWyQIZR0pbHwMDatnD+crPqKSqGPHp1vnlsWM' +
|
||||||
'496pl+mZcAotEpss7PH8crverq86uEK6eUXWogMmE1R5bkjajNPk6QOUpYslaSdwkbnjT' +
|
'/07ubf7bheF7kqSj84Bm0R1fYTfaK8vqqqfKBtNMhe3OZh6N' +
|
||||||
'cdBcCRPcnDb0H24gSZOgy6SCVnS9LqhyIGHgkbyxXihUsRQKK0raTGrVbM+cKEcPOxoYr' +
|
'95CTvMX5HJJi4xOVzCgUOIMSLH7wmeOHaFE4RdpnGavKtrB5' +
|
||||||
'Lj3Uuh+gBtaHx2jjeh65iEHkQ8KNwuPNgmjjwqt9AG+cl5w0Um8dPX5FJCwagLt2fa3/G' +
|
'xzfO/Ll9';
|
||||||
'OF25MDU1bJAhlHSlsfAwNq2cP5ys+opKoY8enW+eWxYz/Tu5t/tuF4XuSpKPzgGbRHV9h' +
|
var expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN496' +
|
||||||
'N9ory+qqp8oG00yF7c5mHo33kJO8xfkckmLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2s' +
|
'pl+mZcAotEpss7PH8crverq86uEK6eUXWogMmE1R5bkjajNPk6Q' +
|
||||||
'HnHNzRtagj5AQAA';
|
'OUpYslaSdwkbnjTcdBcCRPcnDb0H24gSZOgy6SCVnS9LqhyIGHg' +
|
||||||
|
'kbyxXihUsRQKK0raTGrVbM+cKEcPOxoYrLj3Uuh+gBtaHx2jjeh' +
|
||||||
|
'65iEHkQ8KNwuPNgmjjwqt9AG+cl5w0Um8dPX5FJCwagLt2fa3/G' +
|
||||||
|
'OF25MDU1bJAhlHSlsfAwNq2cP5ys+opKoY8enW+eWxYz/Tu5t/t' +
|
||||||
|
'uF4XuSpKPzgGbRHV9hN9ory+qqp8oG00yF7c5mHo33kJO8xfkck' +
|
||||||
|
'mLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2sHnHNzRtagj5AQAA';
|
||||||
|
|
||||||
zlib.deflate(inputString, function(err, buffer) {
|
zlib.deflate(inputString, function(err, buffer) {
|
||||||
assert.equal(buffer.toString('base64'), expectedBase64Deflate,
|
assert.equal(buffer.toString('base64'), expectedBase64Deflate,
|
||||||
|
@ -5,14 +5,15 @@ require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const zlib = require ('zlib');
|
const zlib = require ('zlib');
|
||||||
|
|
||||||
const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing el' +
|
const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' +
|
||||||
'it. Morbi faucibus, purus at gravida dictum, libero arcu convallis la' +
|
't. Morbi faucibus, purus at gravida dictum, libero arcu ' +
|
||||||
'cus, in commodo libero metus eu nisi. Nullam commodo, neque nec porta' +
|
'convallis lacus, in commodo libero metus eu nisi. Nullam' +
|
||||||
' placerat, nisi est fermentum augue, vitae gravida tellus sapien sit ' +
|
' commodo, neque nec porta placerat, nisi est fermentum a' +
|
||||||
'amet tellus. Aenean non diam orci. Proin quis elit turpis. Suspendiss' +
|
'ugue, vitae gravida tellus sapien sit amet tellus. Aenea' +
|
||||||
'e non diam ipsum. Suspendisse nec ullamcorper odio. Vestibulum arcu m' +
|
'n non diam orci. Proin quis elit turpis. Suspendisse non' +
|
||||||
'i, sodales non suscipit id, ultrices ut massa. Sed ac sem sit amet ar' +
|
' diam ipsum. Suspendisse nec ullamcorper odio. Vestibulu' +
|
||||||
'cu malesuada fermentum. Nunc sed. ';
|
'm arcu mi, sodales non suscipit id, ultrices ut massa. S' +
|
||||||
|
'ed ac sem sit amet arcu malesuada fermentum. Nunc sed. ';
|
||||||
|
|
||||||
[
|
[
|
||||||
{ comp: 'gzip', decomp: 'gunzip', decompSync: 'gunzipSync' },
|
{ comp: 'gzip', decomp: 'gunzip', decompSync: 'gunzipSync' },
|
||||||
|
@ -165,9 +165,9 @@ Object.keys(tests).forEach(function(file) {
|
|||||||
// verify that the same exact buffer comes out the other end.
|
// verify that the same exact buffer comes out the other end.
|
||||||
buf.on('data', function(c) {
|
buf.on('data', function(c) {
|
||||||
var msg = file + ' ' +
|
var msg = file + ' ' +
|
||||||
chunkSize + ' ' +
|
chunkSize + ' ' +
|
||||||
JSON.stringify(opts) + ' ' +
|
JSON.stringify(opts) + ' ' +
|
||||||
Def.name + ' -> ' + Inf.name;
|
Def.name + ' -> ' + Inf.name;
|
||||||
var ok = true;
|
var ok = true;
|
||||||
var testNum = ++done;
|
var testNum = ++done;
|
||||||
for (var i = 0; i < Math.max(c.length, test.length); i++) {
|
for (var i = 0; i < Math.max(c.length, test.length); i++) {
|
||||||
|
@ -9,7 +9,7 @@ var stdoutScript = join(common.fixturesDir, 'echo-close-check.js');
|
|||||||
var tmpFile = join(common.fixturesDir, 'stdin.txt');
|
var tmpFile = join(common.fixturesDir, 'stdin.txt');
|
||||||
|
|
||||||
var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' +
|
var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' +
|
||||||
tmpFile + '"';
|
tmpFile + '"';
|
||||||
|
|
||||||
var string = 'abc\nümlaut.\nsomething else\n' +
|
var string = 'abc\nümlaut.\nsomething else\n' +
|
||||||
'南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' +
|
'南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' +
|
||||||
|
@ -6,8 +6,8 @@ var spawn = require('child_process').spawn;
|
|||||||
|
|
||||||
if (process.argv[2] === 'child') {
|
if (process.argv[2] === 'child') {
|
||||||
var code = 'var j = 0;\n' +
|
var code = 'var j = 0;\n' +
|
||||||
'for (var i = 0; i < 1000000; i++) j += add(i, i + 1);\n' +
|
'for (var i = 0; i < 1000000; i++) j += add(i, i + 1);\n' +
|
||||||
'j;';
|
'j;';
|
||||||
|
|
||||||
var ctx = vm.createContext({
|
var ctx = vm.createContext({
|
||||||
add: function(x, y) {
|
add: function(x, y) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const nodeDocUrl = '';
|
const nodeDocUrl = '';
|
||||||
const jsDocUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/' +
|
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/' +
|
const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' +
|
||||||
'JavaScript/Data_structures';
|
'JavaScript/Data_structures';
|
||||||
const jsPrimitives = [
|
const jsPrimitives = [
|
||||||
'Number', 'String', 'Boolean', 'Null', 'Symbol'
|
'Number', 'String', 'Boolean', 'Null', 'Symbol'
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user