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

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

Issue 1639343005: [generators] Implement Generator.prototype.return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@yield-star
Patch Set: Another rebase Created 4 years, 10 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/runtime/runtime-generator.cc ('k') | test/mjsunit/harmony/function-sent.js » ('j') | 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 93
94 // Functions that we associate with generator objects are actually defined by 94 // Functions that we associate with generator objects are actually defined by
95 // a common prototype. 95 // a common prototype.
96 function TestGeneratorObjectPrototype() { 96 function TestGeneratorObjectPrototype() {
97 assertSame(IteratorPrototype, 97 assertSame(IteratorPrototype,
98 Object.getPrototypeOf(GeneratorObjectPrototype)); 98 Object.getPrototypeOf(GeneratorObjectPrototype));
99 assertSame(GeneratorObjectPrototype, 99 assertSame(GeneratorObjectPrototype,
100 Object.getPrototypeOf((function*(){yield 1}).prototype)); 100 Object.getPrototypeOf((function*(){yield 1}).prototype));
101 101
102 var expected_property_names = ["next", "throw", "constructor"]; 102 var expected_property_names = ["next", "return", "throw", "constructor"];
103 var found_property_names = 103 var found_property_names =
104 Object.getOwnPropertyNames(GeneratorObjectPrototype); 104 Object.getOwnPropertyNames(GeneratorObjectPrototype);
105 105
106 expected_property_names.sort(); 106 expected_property_names.sort();
107 found_property_names.sort(); 107 found_property_names.sort();
108 108
109 assertArrayEquals(expected_property_names, found_property_names); 109 assertArrayEquals(expected_property_names, found_property_names);
110 110
111 var constructor_desc = Object.getOwnPropertyDescriptor( 111 var constructor_desc = Object.getOwnPropertyDescriptor(
112 GeneratorObjectPrototype, "constructor"); 112 GeneratorObjectPrototype, "constructor");
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 function TestPerGeneratorPrototype() { 163 function TestPerGeneratorPrototype() {
164 assertTrue((function*(){}).prototype !== (function*(){}).prototype); 164 assertTrue((function*(){}).prototype !== (function*(){}).prototype);
165 assertTrue((function*(){}).prototype !== g.prototype); 165 assertTrue((function*(){}).prototype !== g.prototype);
166 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype)); 166 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype));
167 assertTrue(!(g.prototype instanceof Function)); 167 assertTrue(!(g.prototype instanceof Function));
168 assertSame(typeof (g.prototype), "object"); 168 assertSame(typeof (g.prototype), "object");
169 169
170 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype)); 170 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype));
171 } 171 }
172 TestPerGeneratorPrototype(); 172 TestPerGeneratorPrototype();
OLDNEW
« no previous file with comments | « src/runtime/runtime-generator.cc ('k') | test/mjsunit/harmony/function-sent.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698