diff options
Diffstat (limited to 'js/src/tests/non262/object/accessor-non-constructor.js')
-rw-r--r-- | js/src/tests/non262/object/accessor-non-constructor.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/tests/non262/object/accessor-non-constructor.js b/js/src/tests/non262/object/accessor-non-constructor.js new file mode 100644 index 0000000000..32d1d34673 --- /dev/null +++ b/js/src/tests/non262/object/accessor-non-constructor.js @@ -0,0 +1,20 @@ +var obj = { get a() { return 1; } }; +assertThrowsInstanceOf(() => { + new Object.getOwnPropertyDescriptor(obj, "a").get +}, TypeError); + +obj = { set a(b) { } }; +assertThrowsInstanceOf(() => { + new Object.getOwnPropertyDescriptor(obj, "a").set +}, TypeError); + +obj = { get a() { return 1; }, set a(b) { } }; +assertThrowsInstanceOf(() => { + new Object.getOwnPropertyDescriptor(obj, "a").get +}, TypeError); +assertThrowsInstanceOf(() => { + new Object.getOwnPropertyDescriptor(obj, "a").set +}, TypeError); + +if (typeof reportCompare === "function") + reportCompare(true, true); |