Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: test/mjsunit/harmony/function-name.js

Issue 1582783004: [es6] add SetFunctionName() behaviour to AssignmentExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a bunch more tests Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Flags: --harmony-function-name 5 // Flags: --harmony-function-name
6 6
7 (function testVariableDeclarationsFunction() { 7 (function testVariableDeclarationsFunction() {
8 'use strict'; 8 'use strict';
9 var a = function(){}; 9 var a = function(){};
10 assertEquals('a', a.name); 10 assertEquals('a', a.name);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static [sym2]() { } 113 static [sym2]() { }
114 } 114 }
115 115
116 // Should be 'a' 116 // Should be 'a'
117 assertEquals('', C.prototype[a].name); 117 assertEquals('', C.prototype[a].name);
118 // Should be '[1]' 118 // Should be '[1]'
119 assertEquals('', C.prototype[sym1].name); 119 assertEquals('', C.prototype[sym1].name);
120 // Should be '[2]' 120 // Should be '[2]'
121 assertEquals('', C[sym2].name); 121 assertEquals('', C[sym2].name);
122 })(); 122 })();
123
124
125 (function testAssignment() {
rossberg 2016/01/14 08:01:53 This could take a couple more tests. In particular
126 var basicFn, arrowFn, generatorFn, classLit;
127
128 basicFn = function() { return true; };
129 assertEquals('basicFn', basicFn.name);
130 var basicFn2 = basicFn;
131 assertEquals('basicFn', basicFn2.name);
132 basicFn = function functionWithName() { };
133 assertEquals("functionWithName", basicFn.name);
134
135 arrowFn = x => x;
136 assertEquals('arrowFn', arrowFn.name);
137 var arrowFn2 = arrowFn;
138 assertEquals('arrowFn', arrowFn2.name);
139
140 generatorFn = function*() { yield true; };
141 assertEquals('generatorFn', generatorFn.name);
142 var generatorFn2 = generatorFn;
143 assertEquals('generatorFn', generatorFn2.name);
144 generatorFn = function* generatorWithName() { };
145 assertEquals("generatorWithName", generatorFn.name);
146
147 classLit = class { constructor() {} };
148 assertEquals('classLit', classLit.name);
149 var classLit2 = classLit;
150 assertEquals('classLit', classLit2.name);
151 classLit = class classWithName { constructor() {} };
152 assertEquals('classWithName', classLit.name);
153 classLit = class { constructor() {} static name() {} };
154 assertEquals('function', typeof classLit.name);
155 classLit = class { constructor() {} static get name() { return true; } };
156 assertTrue(classLit.name);
157 classLit = class { constructor() {} static ['name']() {} };
158 assertEquals('function', typeof classLit.name);
159 classLit = class { constructor() {} static get ['name']() { return true; } };
160 assertTrue(classLit.name);
161 })();
OLDNEW
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698