]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/static-getter-put.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 shouldThrow(function () {
23 RegExp
.prototype.global
= 'Cocoa';
24 }, 'TypeError: Attempted to assign to readonly property.');
27 shouldThrow(function () {
29 RegExp
.prototype.global
= 'Cocoa';
30 }, 'TypeError: Attempted to assign to readonly property.');
34 delete RegExp
.prototype.global
;
35 RegExp
.prototype.global
= 'Cocoa';
36 shouldBe(RegExp
.prototype.global
, 'Cocoa');
37 shouldBe(/Cappuccino/.global
, 'Cocoa');