Skip to content
Snippets Groups Projects
Commit a93ef42b authored by Leonardo Balter's avatar Leonardo Balter
Browse files

Fix verifyEnumerable helper to account for Symbol properties

parent b1c979d3
No related branches found
No related tags found
No related merge requests found
...@@ -11,14 +11,8 @@ function isConfigurable(obj, name) { ...@@ -11,14 +11,8 @@ function isConfigurable(obj, name) {
} }
function isEnumerable(obj, name) { function isEnumerable(obj, name) {
for (var prop in obj) { return Object.prototype.hasOwnProperty.call(obj, name) &&
if (Object.prototype.hasOwnProperty.call(obj, prop) && Object.prototype.propertyIsEnumerable.call(obj, name);
assert._isSameValue(prop, name)) {
return true;
}
}
return false;
} }
function isEqualTo(obj, name, expectedValue) { function isEqualTo(obj, name, expectedValue) {
......
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Objects whose specified symbol property is enumerable satisfy the assertion.
includes: [propertyHelper.js]
features: [Symbol]
---*/
var obj = {};
var s = Symbol('1');
Object.defineProperty(obj, s, {
enumerable: true
});
verifyEnumerable(obj, s);
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/*--- /*---
description: > description: >
Objects whose specified property is enumerable satisfy the assertion. Objects whose specified string property is enumerable satisfy the assertion.
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
......
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Objects whose specified symbol property is not enumerable do not satisfy the
assertion.
includes: [propertyHelper.js]
features: [Symbol]
---*/
var threw = false;
var obj = {};
var s = Symbol('1');
Object.defineProperty(obj, s, {
enumerable: false
});
try {
verifyEnumerable(obj, s);
} catch(err) {
threw = true;
if (err.constructor !== Test262Error) {
throw new Test262Error(
'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.'
);
}
}
if (threw === false) {
throw new Test262Error(
'Expected a Test262Error, but no error was thrown for symbol key.'
);
}
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: |
Objects whose specified property is not enumerable do not satisfy the Objects whose specified string property is not enumerable do not satisfy the
assertion. assertion.
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
...@@ -19,7 +19,7 @@ try { ...@@ -19,7 +19,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Test262Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
...@@ -27,5 +27,7 @@ try { ...@@ -27,5 +27,7 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Test262Error(
'Expected a Test262Error, but no error was thrown for string key.'
);
} }
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Objects whose specified symbol property is enumerable do not satisfy the
assertion.
includes: [propertyHelper.js]
features: [Symbol]
---*/
var threw = false;
var obj = {};
var s = Symbol('1');
Object.defineProperty(obj, s, {
enumerable: true
});
try {
verifyNotEnumerable(obj, s);
} catch(err) {
threw = true;
if (err.constructor !== Test262Error) {
throw new Test262Error(
'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.'
);
}
}
if (threw === false) {
throw new Test262Error(
'Expected a Test262Error, but no error was thrown for symbol key.'
);
}
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: |
Objects whose specified property is enumerable do not satisfy the Objects whose specified string property is enumerable do not satisfy the
assertion. assertion.
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
...@@ -27,5 +27,7 @@ try { ...@@ -27,5 +27,7 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Test262Error(
'Expected a Test262Error, but no error was thrown for string key.'
);
} }
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Objects whose specified symbol property is not enumerable satisfy the
assertion.
includes: [propertyHelper.js]
features: [Symbol]
---*/
var obj = {};
var s = Symbol('1');
Object.defineProperty(obj, s, {
enumerable: false
});
verifyNotEnumerable(obj, s);
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: |
Objects whose specified property is not enumerable satisfy the assertion. Objects whose specified string property is not enumerable satisfy the
assertion.
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment