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

deps: cherry-pick 1f53e42 from v8 upstream (v6.x) #7789

Closed
wants to merge 34 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f25c7ce
win,msi: Added Italian translation
mcollina Jan 12, 2016
9db861b
tools: increase lint coverage
Trott Jul 10, 2016
25b3ff4
test,doc: clarify `buf.indexOf(num)` input range
addaleax Jul 8, 2016
45a8fce
doc: fix typo in the CHANGELOG_V6
vsemozhetbyt Jul 6, 2016
8bbb3eb
tools: consistent .eslintrc formatting
silverwind Jul 12, 2016
e1e477e
win,msi: add zh-CN translations for the installer
pmq20 Jul 14, 2016
43b5bf4
inspector: Unify event queues
Jun 1, 2016
ccd4983
test: add common.rootDir
cjihrig Jul 12, 2016
f003465
fs: rename event to eventType in fs.watch listener
claudiorodriguez Jul 1, 2016
1af8c03
test: cleanup IIFE tests
cjihrig Jul 12, 2016
d224b47
test: improve error message in test-tick-processor
Trott Jul 12, 2016
f0d9610
doc: removed old git conflict markers from fs.md
jaimehrubiks Jul 7, 2016
3b767b8
buffer: fix creating from zero-length ArrayBuffer
RReverser Jun 6, 2016
c10ade9
deps: back-port d721121 from v8 upstream
bnoordhuis Jul 9, 2016
a855b30
cluster: remove bind() and self
cjihrig Jul 13, 2016
46b9ef6
doc: fix typo in stream doc
Jul 14, 2016
c726ffb
doc: Warn against `uncaughtException` dependency.
lance Apr 25, 2016
9d9bd3c
timers: fix processing of nested timers
whitlockjc Jul 24, 2015
669af6e
doc: fix inconsistencies in code style
saadq Jul 15, 2016
17591c3
test: s/assert.fail/common.fail as appropriate
cjihrig Jul 14, 2016
3bd40ff
deps: no /safeseh for ml64.exe
indutny Jul 16, 2016
60c459c
util: inspect boxed symbols like other primitives
addaleax Jul 9, 2016
ba6ab7c
buffer: optimize hex_decode
chjj Jul 7, 2016
aa045cd
test: fix flaky test-http-server-consumed-timeout
Trott Jul 13, 2016
f7d3af6
doc: add `added:` information for stream
italoacasas Jun 13, 2016
06bfb9e
src: fix handle leak in Buffer::New()
bnoordhuis Jul 13, 2016
978362d
src: fix handle leak in BuildStatsObject()
bnoordhuis Jul 13, 2016
e46efd9
src: fix handle leak in UDPWrap::Instantiate()
bnoordhuis Jul 13, 2016
61d88d9
src: remove unnecessary HandleScopes
bnoordhuis Jul 13, 2016
62a3ff2
doc: correct sample output of buf.compare
khalsah Jul 17, 2016
9d59b7d
test: avoid usage of mixed IPV6 addresses
gireeshpunathil Jul 13, 2016
059a721
doc: update CTC governance information
Trott Jul 13, 2016
f3182f6
deps: v8_inspector no longer depends on wtf
ofrobots Jul 15, 2016
bb187bb
deps: cherry-pick 1f53e42 from v8 upstream
bnoordhuis Jul 7, 2016
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
Prev Previous commit
Next Next commit
test: cleanup IIFE tests
A number of test files use IIFEs to separate distinct tests from
each other in the same file. The project has been moving toward
using block scopes and let/const in favor of IIFEs. This commit
moves IIFE tests to block scopes. Some additional cleanup such
as use of strictEqual() and common.mustCall() is also included.

PR-URL: #7694
Reviewed-By: Santiago Gimeno <[email protected]>
cjihrig authored and evanlucas committed Jul 18, 2016
commit 1af8c03c99de9e441d6289bee20e6acc918d6988
22 changes: 9 additions & 13 deletions test/gc/test-net-timeout.js
Original file line number Diff line number Diff line change
@@ -35,19 +35,16 @@ function getall() {
if (count >= todo)
return;

(function() {
var req = net.connect(server.address().port, server.address().address);
req.resume();
req.setTimeout(10, function() {
//console.log('timeout (expected)')
req.destroy();
done++;
global.gc();
});
const req = net.connect(server.address().port, server.address().address);
req.resume();
req.setTimeout(10, function() {
req.destroy();
done++;
global.gc();
});

count++;
weak(req, afterGC);
})();
count++;
weak(req, afterGC);

setImmediate(getall);
}
@@ -76,4 +73,3 @@ function status() {
}, 200);
}
}

84 changes: 42 additions & 42 deletions test/parallel/test-buffer-alloc.js
Original file line number Diff line number Diff line change
@@ -1029,28 +1029,28 @@ Buffer.from(Buffer.allocUnsafe(0), 0, 0);


// GH-5110
(function() {
{
const buffer = Buffer.from('test');
const string = JSON.stringify(buffer);

assert.equal(string, '{"type":"Buffer","data":[116,101,115,116]}');
assert.strictEqual(string, '{"type":"Buffer","data":[116,101,115,116]}');

assert.deepStrictEqual(buffer, JSON.parse(string, function(key, value) {
return value && value.type === 'Buffer'
? Buffer.from(value.data)
: value;
}));
})();
}

// issue GH-7849
(function() {
var buf = Buffer.from('test');
var json = JSON.stringify(buf);
var obj = JSON.parse(json);
var copy = Buffer.from(obj);
{
const buf = Buffer.from('test');
const json = JSON.stringify(buf);
const obj = JSON.parse(json);
const copy = Buffer.from(obj);

assert(buf.equals(copy));
})();
}

// issue GH-4331
assert.throws(function() {
@@ -1156,30 +1156,30 @@ assert.throws(function() {
});

// test for common read(U)IntLE/BE
(function() {
{
var buf = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06]);

assert.equal(buf.readUIntLE(0, 1), 0x01);
assert.equal(buf.readUIntBE(0, 1), 0x01);
assert.equal(buf.readUIntLE(0, 3), 0x030201);
assert.equal(buf.readUIntBE(0, 3), 0x010203);
assert.equal(buf.readUIntLE(0, 5), 0x0504030201);
assert.equal(buf.readUIntBE(0, 5), 0x0102030405);
assert.equal(buf.readUIntLE(0, 6), 0x060504030201);
assert.equal(buf.readUIntBE(0, 6), 0x010203040506);
assert.equal(buf.readIntLE(0, 1), 0x01);
assert.equal(buf.readIntBE(0, 1), 0x01);
assert.equal(buf.readIntLE(0, 3), 0x030201);
assert.equal(buf.readIntBE(0, 3), 0x010203);
assert.equal(buf.readIntLE(0, 5), 0x0504030201);
assert.equal(buf.readIntBE(0, 5), 0x0102030405);
assert.equal(buf.readIntLE(0, 6), 0x060504030201);
assert.equal(buf.readIntBE(0, 6), 0x010203040506);
})();
assert.strictEqual(buf.readUIntLE(0, 1), 0x01);
assert.strictEqual(buf.readUIntBE(0, 1), 0x01);
assert.strictEqual(buf.readUIntLE(0, 3), 0x030201);
assert.strictEqual(buf.readUIntBE(0, 3), 0x010203);
assert.strictEqual(buf.readUIntLE(0, 5), 0x0504030201);
assert.strictEqual(buf.readUIntBE(0, 5), 0x0102030405);
assert.strictEqual(buf.readUIntLE(0, 6), 0x060504030201);
assert.strictEqual(buf.readUIntBE(0, 6), 0x010203040506);
assert.strictEqual(buf.readIntLE(0, 1), 0x01);
assert.strictEqual(buf.readIntBE(0, 1), 0x01);
assert.strictEqual(buf.readIntLE(0, 3), 0x030201);
assert.strictEqual(buf.readIntBE(0, 3), 0x010203);
assert.strictEqual(buf.readIntLE(0, 5), 0x0504030201);
assert.strictEqual(buf.readIntBE(0, 5), 0x0102030405);
assert.strictEqual(buf.readIntLE(0, 6), 0x060504030201);
assert.strictEqual(buf.readIntBE(0, 6), 0x010203040506);
}

// test for common write(U)IntLE/BE
(function() {
var buf = Buffer.allocUnsafe(3);
{
let buf = Buffer.allocUnsafe(3);
buf.writeUIntLE(0x123456, 0, 3);
assert.deepStrictEqual(buf.toJSON().data, [0x56, 0x34, 0x12]);
assert.equal(buf.readUIntLE(0, 3), 0x123456);
@@ -1268,11 +1268,11 @@ assert.throws(function() {
buf.writeIntBE(-0x0012000000, 0, 5);
assert.deepStrictEqual(buf.toJSON().data, [0xff, 0xee, 0x00, 0x00, 0x00]);
assert.equal(buf.readIntBE(0, 5), -0x0012000000);
})();
}

// test Buffer slice
(function() {
var buf = Buffer.from('0123456789');
{
const buf = Buffer.from('0123456789');
assert.equal(buf.slice(-10, 10), '0123456789');
assert.equal(buf.slice(-20, 10), '0123456789');
assert.equal(buf.slice(-20, -10), '');
@@ -1305,7 +1305,7 @@ assert.throws(function() {
assert.equal(buf.slice(0, -i), s.slice(0, -i));
}

var utf16Buf = Buffer.from('0123456789', 'utf16le');
const utf16Buf = Buffer.from('0123456789', 'utf16le');
assert.deepStrictEqual(utf16Buf.slice(0, 6), Buffer.from('012', 'utf16le'));

assert.equal(buf.slice('0', '1'), '0');
@@ -1319,7 +1319,7 @@ assert.throws(function() {
// try to slice a zero length Buffer
// see https://github.com/joyent/node/issues/5881
Buffer.alloc(0).slice(0, 1);
})();
}

// Regression test for #5482: should throw but not assert in C++ land.
assert.throws(function() {
@@ -1328,20 +1328,20 @@ assert.throws(function() {

// Regression test for #6111. Constructing a buffer from another buffer
// should a) work, and b) not corrupt the source buffer.
(function() {
var a = [0];
{
let a = [0];
for (let i = 0; i < 7; ++i) a = a.concat(a);
a = a.map(function(_, i) { return i; });
const b = Buffer.from(a);
const c = Buffer.from(b);
assert.equal(b.length, a.length);
assert.equal(c.length, a.length);
assert.strictEqual(b.length, a.length);
assert.strictEqual(c.length, a.length);
for (let i = 0, k = a.length; i < k; ++i) {
assert.equal(a[i], i);
assert.equal(b[i], i);
assert.equal(c[i], i);
assert.strictEqual(a[i], i);
assert.strictEqual(b[i], i);
assert.strictEqual(c[i], i);
}
})();
}


assert.throws(function() {
88 changes: 44 additions & 44 deletions test/parallel/test-buffer.js
Original file line number Diff line number Diff line change
@@ -1031,28 +1031,28 @@ Buffer(Buffer(0), 0, 0);


// GH-5110
(function() {
{
const buffer = new Buffer('test');
const string = JSON.stringify(buffer);

assert.equal(string, '{"type":"Buffer","data":[116,101,115,116]}');
assert.strictEqual(string, '{"type":"Buffer","data":[116,101,115,116]}');

assert.deepStrictEqual(buffer, JSON.parse(string, function(key, value) {
return value && value.type === 'Buffer'
? new Buffer(value.data)
: value;
}));
})();
}

// issue GH-7849
(function() {
var buf = new Buffer('test');
var json = JSON.stringify(buf);
var obj = JSON.parse(json);
var copy = new Buffer(obj);
{
const buf = new Buffer('test');
const json = JSON.stringify(buf);
const obj = JSON.parse(json);
const copy = new Buffer(obj);

assert(buf.equals(copy));
})();
}

// issue GH-4331
assert.throws(function() {
@@ -1168,30 +1168,30 @@ assert.throws(function() {
});

// test for common read(U)IntLE/BE
(function() {
var buf = new Buffer([0x01, 0x02, 0x03, 0x04, 0x05, 0x06]);

assert.equal(buf.readUIntLE(0, 1), 0x01);
assert.equal(buf.readUIntBE(0, 1), 0x01);
assert.equal(buf.readUIntLE(0, 3), 0x030201);
assert.equal(buf.readUIntBE(0, 3), 0x010203);
assert.equal(buf.readUIntLE(0, 5), 0x0504030201);
assert.equal(buf.readUIntBE(0, 5), 0x0102030405);
assert.equal(buf.readUIntLE(0, 6), 0x060504030201);
assert.equal(buf.readUIntBE(0, 6), 0x010203040506);
assert.equal(buf.readIntLE(0, 1), 0x01);
assert.equal(buf.readIntBE(0, 1), 0x01);
assert.equal(buf.readIntLE(0, 3), 0x030201);
assert.equal(buf.readIntBE(0, 3), 0x010203);
assert.equal(buf.readIntLE(0, 5), 0x0504030201);
assert.equal(buf.readIntBE(0, 5), 0x0102030405);
assert.equal(buf.readIntLE(0, 6), 0x060504030201);
assert.equal(buf.readIntBE(0, 6), 0x010203040506);
})();
{
const buf = new Buffer([0x01, 0x02, 0x03, 0x04, 0x05, 0x06]);

assert.strictEqual(buf.readUIntLE(0, 1), 0x01);
assert.strictEqual(buf.readUIntBE(0, 1), 0x01);
assert.strictEqual(buf.readUIntLE(0, 3), 0x030201);
assert.strictEqual(buf.readUIntBE(0, 3), 0x010203);
assert.strictEqual(buf.readUIntLE(0, 5), 0x0504030201);
assert.strictEqual(buf.readUIntBE(0, 5), 0x0102030405);
assert.strictEqual(buf.readUIntLE(0, 6), 0x060504030201);
assert.strictEqual(buf.readUIntBE(0, 6), 0x010203040506);
assert.strictEqual(buf.readIntLE(0, 1), 0x01);
assert.strictEqual(buf.readIntBE(0, 1), 0x01);
assert.strictEqual(buf.readIntLE(0, 3), 0x030201);
assert.strictEqual(buf.readIntBE(0, 3), 0x010203);
assert.strictEqual(buf.readIntLE(0, 5), 0x0504030201);
assert.strictEqual(buf.readIntBE(0, 5), 0x0102030405);
assert.strictEqual(buf.readIntLE(0, 6), 0x060504030201);
assert.strictEqual(buf.readIntBE(0, 6), 0x010203040506);
}

// test for common write(U)IntLE/BE
(function() {
var buf = Buffer(3);
{
let buf = Buffer(3);
buf.writeUIntLE(0x123456, 0, 3);
assert.deepStrictEqual(buf.toJSON().data, [0x56, 0x34, 0x12]);
assert.equal(buf.readUIntLE(0, 3), 0x123456);
@@ -1280,11 +1280,11 @@ assert.throws(function() {
buf.writeIntBE(-0x0012000000, 0, 5);
assert.deepStrictEqual(buf.toJSON().data, [0xff, 0xee, 0x00, 0x00, 0x00]);
assert.equal(buf.readIntBE(0, 5), -0x0012000000);
})();
}

// test Buffer slice
(function() {
var buf = new Buffer('0123456789');
{
const buf = new Buffer('0123456789');
assert.equal(buf.slice(-10, 10), '0123456789');
assert.equal(buf.slice(-20, 10), '0123456789');
assert.equal(buf.slice(-20, -10), '');
@@ -1317,7 +1317,7 @@ assert.throws(function() {
assert.equal(buf.slice(0, -i), s.slice(0, -i));
}

var utf16Buf = new Buffer('0123456789', 'utf16le');
const utf16Buf = new Buffer('0123456789', 'utf16le');
assert.deepStrictEqual(utf16Buf.slice(0, 6), Buffer('012', 'utf16le'));

assert.equal(buf.slice('0', '1'), '0');
@@ -1331,7 +1331,7 @@ assert.throws(function() {
// try to slice a zero length Buffer
// see https://github.com/joyent/node/issues/5881
SlowBuffer(0).slice(0, 1);
})();
}

// Regression test for #5482: should throw but not assert in C++ land.
assert.throws(function() {
@@ -1340,20 +1340,20 @@ assert.throws(function() {

// Regression test for #6111. Constructing a buffer from another buffer
// should a) work, and b) not corrupt the source buffer.
(function() {
var a = [0];
{
let a = [0];
for (let i = 0; i < 7; ++i) a = a.concat(a);
a = a.map(function(_, i) { return i; });
const b = Buffer(a);
const c = Buffer(b);
assert.equal(b.length, a.length);
assert.equal(c.length, a.length);
assert.strictEqual(b.length, a.length);
assert.strictEqual(c.length, a.length);
for (let i = 0, k = a.length; i < k; ++i) {
assert.equal(a[i], i);
assert.equal(b[i], i);
assert.equal(c[i], i);
assert.strictEqual(a[i], i);
assert.strictEqual(b[i], i);
assert.strictEqual(c[i], i);
}
})();
}


assert.throws(function() {
15 changes: 4 additions & 11 deletions test/parallel/test-child-process-cwd.js
Original file line number Diff line number Diff line change
@@ -44,18 +44,11 @@ if (common.isWindows) {
}

// Assume does-not-exist doesn't exist, expect exitCode=-1 and errno=ENOENT
(function() {
var errors = 0;

testCwd({cwd: 'does-not-exist'}, -1).on('error', function(e) {
{
testCwd({cwd: 'does-not-exist'}, -1).on('error', common.mustCall(function(e) {
assert.equal(e.code, 'ENOENT');
errors++;
});

process.on('exit', function() {
assert.equal(errors, 1);
});
})();
}));
}

// Spawn() shouldn't try to chdir() so this should just work
testCwd(undefined, 0);
Loading