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

Side by Side Diff: test/mjsunit/harmony/generators-runtime.js

Issue 14912002: toString() on generator functions prints with function* (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Remove TODO Created 7 years, 7 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/v8natives.js ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // This tests the object that would be called "GeneratorFunction", if it were 99 // This tests the object that would be called "GeneratorFunction", if it were
100 // like "Function". 100 // like "Function".
101 function TestGeneratorFunction() { 101 function TestGeneratorFunction() {
102 assertSame(GeneratorFunctionPrototype, GeneratorFunction.prototype); 102 assertSame(GeneratorFunctionPrototype, GeneratorFunction.prototype);
103 assertTrue(g instanceof GeneratorFunction); 103 assertTrue(g instanceof GeneratorFunction);
104 104
105 assertSame(Function, Object.getPrototypeOf(GeneratorFunction)); 105 assertSame(Function, Object.getPrototypeOf(GeneratorFunction));
106 assertTrue(g instanceof Function); 106 assertTrue(g instanceof Function);
107 107
108 assertEquals("function* g() { yield 1; }", g.toString());
109
108 // Not all functions are generators. 110 // Not all functions are generators.
109 assertTrue(f instanceof Function); // Sanity check. 111 assertTrue(f instanceof Function); // Sanity check.
110 assertTrue(!(f instanceof GeneratorFunction)); 112 assertTrue(!(f instanceof GeneratorFunction));
111 } 113 }
112 TestGeneratorFunction(); 114 TestGeneratorFunction();
113 115
114 116
115 function TestPerGeneratorPrototype() { 117 function TestPerGeneratorPrototype() {
116 assertTrue((function*(){}).prototype !== (function*(){}).prototype); 118 assertTrue((function*(){}).prototype !== (function*(){}).prototype);
117 assertTrue((function*(){}).prototype !== g.prototype); 119 assertTrue((function*(){}).prototype !== g.prototype);
118 assertTrue(g.prototype instanceof GeneratorFunctionPrototype); 120 assertTrue(g.prototype instanceof GeneratorFunctionPrototype);
119 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype)); 121 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype));
120 assertTrue(!(g.prototype instanceof Function)); 122 assertTrue(!(g.prototype instanceof Function));
121 assertSame(typeof (g.prototype), "object"); 123 assertSame(typeof (g.prototype), "object");
122 124
123 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype)); 125 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype));
124 } 126 }
125 TestPerGeneratorPrototype(); 127 TestPerGeneratorPrototype();
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698