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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/function-name.js
diff --git a/test/mjsunit/harmony/function-name.js b/test/mjsunit/harmony/function-name.js
index af49bc0b2c3b4843b3bda782be397638d005afc5..8ca5d8209acd988d4273f9abfa3b5d9ebe52fc1b 100644
--- a/test/mjsunit/harmony/function-name.js
+++ b/test/mjsunit/harmony/function-name.js
@@ -120,3 +120,42 @@
// Should be '[2]'
assertEquals('', C[sym2].name);
})();
+
+
+(function testAssignment() {
rossberg 2016/01/14 08:01:53 This could take a couple more tests. In particular
+ var basicFn, arrowFn, generatorFn, classLit;
+
+ basicFn = function() { return true; };
+ assertEquals('basicFn', basicFn.name);
+ var basicFn2 = basicFn;
+ assertEquals('basicFn', basicFn2.name);
+ basicFn = function functionWithName() { };
+ assertEquals("functionWithName", basicFn.name);
+
+ arrowFn = x => x;
+ assertEquals('arrowFn', arrowFn.name);
+ var arrowFn2 = arrowFn;
+ assertEquals('arrowFn', arrowFn2.name);
+
+ generatorFn = function*() { yield true; };
+ assertEquals('generatorFn', generatorFn.name);
+ var generatorFn2 = generatorFn;
+ assertEquals('generatorFn', generatorFn2.name);
+ generatorFn = function* generatorWithName() { };
+ assertEquals("generatorWithName", generatorFn.name);
+
+ classLit = class { constructor() {} };
+ assertEquals('classLit', classLit.name);
+ var classLit2 = classLit;
+ assertEquals('classLit', classLit2.name);
+ classLit = class classWithName { constructor() {} };
+ assertEquals('classWithName', classLit.name);
+ classLit = class { constructor() {} static name() {} };
+ assertEquals('function', typeof classLit.name);
+ classLit = class { constructor() {} static get name() { return true; } };
+ assertTrue(classLit.name);
+ classLit = class { constructor() {} static ['name']() {} };
+ assertEquals('function', typeof classLit.name);
+ classLit = class { constructor() {} static get ['name']() { return true; } };
+ assertTrue(classLit.name);
+})();
« 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