blob: ec1470971768e62e2a999fa948c62cedb52336a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
description(
"This test checks whether various forms of assignment expression are allowed."
);
var x = 0;
var y = 0;
shouldBe('x = 1; x', '1');
shouldBe('window.x = 2; x', '2');
shouldBe('window["x"] = 3; x', '3');
shouldBe('(x) = 4; x', "4");
shouldBe('(window.x) = 5; x', '5');
shouldBe('(window["x"]) = 6; x', '6');
shouldBe('y, x = 7; x', '7');
shouldBe('((x)) = 8; x', '8');
shouldBe('((window.x)) = 9; x', '9');
shouldBe('((window["x"])) = 10; x', '10');
shouldThrow('(y, x) = "FAIL";');
shouldThrow('(true ? x : y) = "FAIL";');
shouldThrow('x++ = "FAIL";');
|