Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
fix test-sys for hash randomization
Browse files Browse the repository at this point in the history
broken in 4a899c9
  • Loading branch information
ry committed Jan 6, 2012
1 parent 4a899c9 commit 8bd80f4
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions test/simple/test-sys.js
Expand Up @@ -60,17 +60,29 @@ assert.equal('{ visible: 1 }',
common.inspect(Object.create({},
{visible: {value: 1, enumerable: true}, hidden: {value: 2}}))
);
assert.equal('{ [hidden]: 2, visible: 1 }',
common.inspect(Object.create({},
{visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true)
);

// Due to the hash seed randomization it's not deterministic the order that
// the following ways this hash is displayed.
// See http://codereview.chromium.org/9124004/

var out = common.inspect(Object.create({},
{visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true);
if (out !== '{ [hidden]: 2, visible: 1 }' &&
out !== '{ visible: 1, [hidden]: 2 }') {
assert.ok(false);
}


// Objects without prototype
assert.equal('{ [hidden]: \'secret\', name: \'Tim\' }',
common.inspect(Object.create(null,
{name: {value: 'Tim', enumerable: true},
hidden: {value: 'secret'}}), true)
);
var out = common.inspect(Object.create(null,
{ name: {value: 'Tim', enumerable: true},
hidden: {value: 'secret'}}), true);
if (out !== "{ [hidden]: 'secret', name: 'Tim' }" &&
out !== "{ name: 'Tim', [hidden]: 'secret' }") {
assert(false);
}


assert.equal('{ name: \'Tim\' }',
common.inspect(Object.create(null,
{name: {value: 'Tim', enumerable: true},
Expand Down

0 comments on commit 8bd80f4

Please sign in to comment.