mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
assert: fix deepEqual regression
Change of Object.keys in ES6 breaks assert.deepEqual about primitive values. V8: https://code.google.com/p/v8/issues/detail?id=3443 Previously deepEqual depends on Object.key that throws an error for a primitive value, but now Object.key does not throw. PR-URL: https://github.com/iojs/io.js/pull/193 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
1 parent
ef10827c9f
commit
00a7456c19
2 files changed
+22
-11
No files matched your search
@@ -153,8 +153,22 @@ nameBuilder2.prototype = Object;
|
||||
nb2 = new nameBuilder2('Ryan', 'Dahl');
|
||||
assert.throws(makeBlock(a.deepEqual, nb1, nb2), a.AssertionError);
|
||||
|
||||
// String literal + object blew up my implementation...
|
||||
assert.throws(makeBlock(a.deepEqual, 'a', {}), a.AssertionError);
|
||||
// primitives and object
|
||||
assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError);
|
||||
assert.throws(makeBlock(a.deepEqual, undefined, {}), a.AssertionError);
|
||||
assert.throws(makeBlock(a.deepEqual, 'a', ['a']), a.AssertionError);
|
||||
assert.throws(makeBlock(a.deepEqual, 'a', {0: 'a'}), a.AssertionError);
|
||||
assert.throws(makeBlock(a.deepEqual, 1, {}), a.AssertionError);
|
||||
assert.throws(makeBlock(a.deepEqual, true, {}), a.AssertionError);
|
||||
if (typeof Symbol === 'symbol') {
|
||||
assert.throws(makeBlock(assert.deepEqual, Symbol(), {}), a.AssertionError);
|
||||
}
|
||||
|
||||
// primitive wrappers and object
|
||||
assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), ['a']), a.AssertionError);
|
||||
assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), {0: 'a'}), a.AssertionError);
|
||||
assert.doesNotThrow(makeBlock(a.deepEqual, new Number(1), {}), a.AssertionError);
|
||||
assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}), a.AssertionError);
|
||||
|
||||
// Testing the throwing
|
||||
function thrower(errorConstructor) {
|
||||
|
||||
Reference in new issue
Block a user