Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / assign.js
blobec1470971768e62e2a999fa948c62cedb52336a6
1 description(
2 "This test checks whether various forms of assignment expression are allowed."
3 );
5 var x = 0;
6 var y = 0;
8 shouldBe('x = 1; x', '1');
10 shouldBe('window.x = 2; x', '2');
11 shouldBe('window["x"] = 3; x', '3');
12 shouldBe('(x) = 4; x', "4");
13 shouldBe('(window.x) = 5; x', '5');
14 shouldBe('(window["x"]) = 6; x', '6');
15 shouldBe('y, x = 7; x', '7');
16 shouldBe('((x)) = 8; x', '8');
17 shouldBe('((window.x)) = 9; x', '9');
18 shouldBe('((window["x"])) = 10; x', '10');
20 shouldThrow('(y, x) = "FAIL";');
21 shouldThrow('(true ? x : y) = "FAIL";');
22 shouldThrow('x++ = "FAIL";');