test262-automation 24f861721f [javascriptcore-test262-automation] Updated curation log with latest revision sha's from export and changed files.
sourceRevisionAtLastExport: 8bfa53d50 targetRevisionAtLastExport: 8bc4e38a
2018-07-29 23:55:12 -04:00

33 lines
709 B
JavaScript

function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
class A {
get cocoa() {
return "Cocoa";
}
get cappuccino() {
return "Cappuccino";
}
}
let a = new A();
shouldBe(JSON.stringify(a), `{}`);
shouldBe(JSON.stringify(a, ["cocoa", "cappuccino"]), `{"cocoa":"Cocoa","cappuccino":"Cappuccino"}`);
let array = [0, 1, 2, 3, 4];
Object.defineProperty(array.__proto__, 1, {
get: function () {
return "Cocoa";
}
});
Object.defineProperty(array, 0, {
get: function () {
delete array[1];
return "Cappuccino";
}
});
shouldBe(JSON.stringify(array), `["Cappuccino","Cocoa",2,3,4]`);