]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/static-getter-delete.js
1 function shouldBe(actual
, expected
) {
2 if (actual
!== expected
)
3 throw new Error('bad value: ' + actual
);
6 function shouldThrow(func
, errorMessage
) {
7 var errorThrown
= false;
16 throw new Error('not thrown');
17 if (String(error
) !== errorMessage
)
18 throw new Error(`bad error: ${String(error)}`);
21 // Before static functions (& accessors) are reified.
22 shouldThrow(function () {
24 RegExp
.prototype.multiline
= 'ok';
25 }, 'TypeError: Attempted to assign to readonly property.');
29 shouldBe(delete RegExp
.prototype.global
, true);
30 shouldBe(RegExp
.prototype.hasOwnProperty('global'), false);
31 RegExp
.prototype.global
= 'hello'
32 shouldBe(RegExp
.prototype.global
, 'hello');
35 // After static functions (& accessors) are reified.
36 shouldThrow(function () {
38 RegExp
.prototype.multiline
= 'ok';
39 }, 'TypeError: Attempted to assign to readonly property.');
43 shouldBe(delete RegExp
.prototype.multiline
, true);
44 shouldBe(RegExp
.prototype.hasOwnProperty('multiline'), false);
45 RegExp
.prototype.multiline
= 'hello'
46 shouldBe(RegExp
.prototype.multiline
, 'hello');