[ES6] Implement ES6 arrow function syntax. Prototype of arrow function should be...
[WebKit-https.git] / LayoutTests / js / script-tests / arrowfunction-prototype.js
1 // Inspired by mozilla tests
2 description('Tests for ES6 arrow function prototype property');
3
4 var af1 = () =>  {};
5
6 debug('() =>  {}');
7 shouldBe("typeof af1.prototype", "'undefined'");
8 shouldBe("af1.hasOwnProperty('prototype')", "false");
9
10 var af2 = (a) => {a + 1};
11
12 debug('(a) => {a + 1}');
13 shouldBe("typeof af2.prototype", "'undefined'");
14 shouldBe("af2.hasOwnProperty('prototype')", "false");
15
16 var af3 = (x) =>  x + 1;
17
18 debug('(x) =>  x + 1');
19 shouldBe("typeof af3.prototype", "'undefined'");
20 shouldBe("af3.hasOwnProperty('prototype')", "false");
21
22
23 af1.prototype = function (x) { return x + 1;};
24
25 debug('af1.prototype = function (x) { return x + 1;}');
26 shouldBe("typeof af1.prototype", "'function'");
27 shouldBe("af1.prototype.toString()", "'function (x) { return x + 1;}'");
28 shouldBe("af1.hasOwnProperty('prototype')", "true");
29
30 delete af1.prototype;
31
32 debug('delete af1.prototype');
33 shouldBe("typeof af1.prototype", "'undefined'");
34 shouldBe("af1.hasOwnProperty('prototype')", "false");
35
36 var successfullyParsed = true;