mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
46 lines
942 B
JavaScript
46 lines
942 B
JavaScript
function shouldBe(actual, expected) {
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
Object.defineProperty(Array.prototype, '0', {
|
|
get() {
|
|
throw new Error('out');
|
|
},
|
|
set(value) {
|
|
throw new Error('out');
|
|
}
|
|
});
|
|
|
|
{
|
|
let object = {
|
|
a: 42,
|
|
b: 42,
|
|
c: 42
|
|
};
|
|
{
|
|
let result = Object.keys(object);
|
|
shouldBe(JSON.stringify(result), `["a","b","c"]`);
|
|
}
|
|
{
|
|
let result = Object.values(object);
|
|
shouldBe(JSON.stringify(result), `[42,42,42]`);
|
|
}
|
|
}
|
|
{
|
|
let object = {
|
|
[Symbol.iterator]: 42,
|
|
b: 42,
|
|
c: 42
|
|
};
|
|
{
|
|
let result = Object.getOwnPropertyNames(object);
|
|
shouldBe(JSON.stringify(result), `["b","c"]`);
|
|
}
|
|
{
|
|
let result = Object.getOwnPropertySymbols(object);
|
|
shouldBe(result.length, 1);
|
|
shouldBe(result[0], Symbol.iterator);
|
|
}
|
|
}
|