summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testIncDecReadOnly.js
blob: 5ff23b249587abca26b079e84d2a065986989bb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var r;
Object.defineProperty(this, "x", {value: 0, writable: false});

for (var a = 0; a < 10; ++a)
    r = ++x;
assertEq(x, 0);
assertEq(r, 1);

for (var a = 0; a < 10; ++a)
    r = --x;
assertEq(x, 0);
assertEq(r, -1);

for (var a = 0; a < 10; ++a)
    r = x++;
assertEq(x, 0);
assertEq(r, 0);

for (var a = 0; a < 10; ++a)
    r = x--;
assertEq(x, 0);
assertEq(r, 0);