test262-automation e9a5a7f918 [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) (#1620)
* [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)
2018-07-03 15:59:58 -04:00

68 lines
1.9 KiB
JavaScript

//@ runDefault
var createBuiltin = $vm.createBuiltin;
var loadGetterFromGetterSetter = $vm.loadGetterFromGetterSetter;
var exception;
var getter;
try {
getter = loadGetterFromGetterSetter();
} catch (e) {
exception = e;
}
if (exception != "TypeError: Invalid use of loadGetterFromGetterSetter test function: argument is not a GetterSetter")
throw "FAILED";
if (getter)
throw "FAILED: unexpected result";
exception = undefined;
try {
getter = loadGetterFromGetterSetter(undefined);
} catch (e) {
exception = e;
}
if (exception != "TypeError: Invalid use of loadGetterFromGetterSetter test function: argument is not a GetterSetter")
throw "FAILED";
if (getter)
throw "FAILED: unexpected result";
exception = undefined;
function tryGetByIdText(propertyName) { return `(function (base) { return @tryGetById(base, '${propertyName}'); })`; }
let getSetterGetter = createBuiltin(tryGetByIdText("bar"));
try {
noGetterSetter = { };
getter = loadGetterFromGetterSetter(getSetterGetter(noGetterSetter, "bar"));
} catch (e) {
exception = e;
}
if (exception != "TypeError: Invalid use of loadGetterFromGetterSetter test function: argument is not a GetterSetter")
throw "FAILED";
if (getter)
throw "FAILED: unexpected result";
exception = undefined;
try {
hasGetter = { get bar() { return 22; } };
getter = loadGetterFromGetterSetter(getSetterGetter(hasGetter, "bar"));
} catch (e) {
exception = e;
}
if (exception)
throw "FAILED: unexpected exception: " + exception;
if (!getter)
throw "FAILED: unable to get getter";
try {
// When a getter is not specified, a default getter should be assigned as long as there's also a setter.
hasSetter = { set bar(x) { return 22; } };
getter = loadGetterFromGetterSetter(getSetterGetter(hasSetter, "bar"));
} catch (e) {
exception = e;
}
if (exception)
throw "FAILED: unexpected exception: " + exception;
if (!getter)
throw "FAILED: unexpected result";