Commit accbbd2c authored by rossberg@chromium.org's avatar rossberg@chromium.org

ES6 symbols: refine test for getOwnPropertyNames

R=mstarzinger@chromium.org
BUG=v8:2158

Review URL: https://codereview.chromium.org/12432005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13866 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c0d7aa16
......@@ -184,9 +184,25 @@ function TestKeyEnum(obj) {
}
function TestKeyKeys(obj) {
function TestKeyNames(obj) {
assertEquals(0, Object.keys(obj).length)
assertTrue(symbols.length <= Object.getOwnPropertyNames(obj).length)
var names = Object.getOwnPropertyNames(obj)
assertTrue(symbols.length <= names.length)
// TODO(rossberg): once we have iterators, the following would be:
// var expected = new Set(symbols)
var expected = new Set
for (var i = 0; i < symbols.length; ++i) expected.add(symbols[i])
for (var i = 0; i < names.length; ++i) {
var name = names[i]
var asString = String(name)
if (asString !== name) {
assertEquals("[object Symbol]", asString)
assertTrue(expected.has(name))
expected.delete(name)
}
}
assertEquals(0, expected.size)
}
......@@ -222,7 +238,7 @@ for (var i in objs) {
TestKeyGet(obj)
TestKeyHas(obj)
TestKeyEnum(obj)
TestKeyKeys(obj)
TestKeyNames(obj)
TestKeyDescriptor(obj)
TestKeyDelete(obj)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment