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

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

Issue 1530213002: Make generators non-constructable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove broken tests Created 5 years 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 testNext(g); 95 testNext(g);
96 testSend(g); 96 testSend(g);
97 testThrow(g); 97 testThrow(g);
98 98
99 testNext(function*() { return yield* g(); }); 99 testNext(function*() { return yield* g(); });
100 testSend(function*() { return yield* g(); }); 100 testSend(function*() { return yield* g(); });
101 testThrow(function*() { return yield* g(); }); 101 testThrow(function*() { return yield* g(); });
102 102
103 if (g instanceof GeneratorFunction) { 103 if (g instanceof GeneratorFunction) {
104 testNext(function() { return new g(); }); 104 testNext(function() { return g(); });
neis 2016/01/14 10:55:23 testNext(g) etc
105 testSend(function() { return new g(); }); 105 testSend(function() { return g(); });
106 testThrow(function() { return new g(); }); 106 testThrow(function() { return g(); });
107 } 107 }
108 } 108 }
109 109
110 TestGenerator(function* g1() { }, 110 TestGenerator(function* g1() { },
111 [undefined], 111 [undefined],
112 "foo", 112 "foo",
113 [undefined]); 113 [undefined]);
114 114
115 TestGenerator(function* g2() { yield 1; }, 115 TestGenerator(function* g2() { yield 1; },
116 [1, undefined], 116 [1, undefined],
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ["fee", "fi", "fo", "fum", undefined], 240 ["fee", "fi", "fo", "fum", undefined],
241 "foo", 241 "foo",
242 ["fee", "fi", "fo", "fum", undefined]); 242 ["fee", "fi", "fo", "fum", undefined]);
243 243
244 // GC. 244 // GC.
245 TestGenerator(function* g16() { yield "baz"; gc(); yield "qux"; }, 245 TestGenerator(function* g16() { yield "baz"; gc(); yield "qux"; },
246 ["baz", "qux", undefined], 246 ["baz", "qux", undefined],
247 "foo", 247 "foo",
248 ["baz", "qux", undefined]); 248 ["baz", "qux", undefined]);
249 249
250 // Receivers.
251 TestGenerator(
neis 2016/01/14 10:55:23 This one should still be fine, shouldn't it?
252 function g17() {
253 function* g() { yield this.x; yield this.y; }
254 var o = { start: g, x: 1, y: 2 };
255 return o.start();
256 },
257 [1, 2, undefined],
258 "foo",
259 [1, 2, undefined]);
260
261 TestGenerator(
262 function g18() {
263 function* g() { yield this.x; yield this.y; }
264 var iter = new g;
265 iter.x = 1;
266 iter.y = 2;
267 return iter;
268 },
269 [1, 2, undefined],
270 "foo",
271 [1, 2, undefined]);
272
273 TestGenerator( 250 TestGenerator(
274 function* g19() { 251 function* g19() {
275 var x = 1; 252 var x = 1;
276 yield x; 253 yield x;
277 with({x:2}) { yield x; } 254 with({x:2}) { yield x; }
278 yield x; 255 yield x;
279 }, 256 },
280 [1, 2, 1, undefined], 257 [1, 2, 1, undefined],
281 "foo", 258 "foo",
282 [1, 2, 1, undefined]); 259 [1, 2, 1, undefined]);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 function TestThrowRecursion() { 663 function TestThrowRecursion() {
687 function* g() { yield iter.throw(1); } 664 function* g() { yield iter.throw(1); }
688 var iter = g(); 665 var iter = g();
689 return iter.next(); 666 return iter.next();
690 } 667 }
691 assertThrows(TestNextRecursion, Error); 668 assertThrows(TestNextRecursion, Error);
692 assertThrows(TestSendRecursion, Error); 669 assertThrows(TestSendRecursion, Error);
693 assertThrows(TestThrowRecursion, Error); 670 assertThrows(TestThrowRecursion, Error);
694 } 671 }
695 TestRecursion(); 672 TestRecursion();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698