Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / names.js
blob14dc141660babeadb6c52ebc443e9dfad70f51c4
1 description(
2 "This tests an early experimental implementation of ES6-esque private names."
3 );
5 function forIn(o)
7 var a = [];
8 for (x in o)
9 a.push(x);
10 return a;
13 var prop = Name("prop");
14 var o = {};
16 shouldBeFalse("prop in o");
17 shouldBeFalse("'prop' in o");
18 shouldBe("Object.getOwnPropertyNames(o).length", '0');
19 shouldBe("forIn(o)", '[]');
21 o[prop] = 42;
23 shouldBeTrue("prop in o");
24 shouldBeFalse("'prop' in o");
25 shouldBe("Object.getOwnPropertyNames(o).length", '0');
26 shouldBe("forIn(o)", '[]');
28 o['prop'] = 101;
30 shouldBe("o[prop]", '42');
31 shouldBe("o['prop']", '101');
32 shouldBe("Object.getOwnPropertyNames(o).length", '1');
33 shouldBe("forIn(o)", '["prop"]');
35 delete o[prop];
37 shouldBeFalse("prop in o");
38 shouldBeTrue("'prop' in o");
39 shouldBe("Object.getOwnPropertyNames(o).length", '1');
40 shouldBe("forIn(o)", '["prop"]');
42 successfullyParsed = true;