OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 function assertIteratorResult(value, done, result) { | 34 function assertIteratorResult(value, done, result) { |
35 assertEquals({ value: value, done: done}, result); | 35 assertEquals({ value: value, done: done}, result); |
36 } | 36 } |
37 | 37 |
38 function assertIteratorIsClosed(iter) { | 38 function assertIteratorIsClosed(iter) { |
39 assertIteratorResult(undefined, true, iter.next()); | 39 assertIteratorResult(undefined, true, iter.next()); |
40 assertDoesNotThrow(function() { iter.next(); }); | 40 assertDoesNotThrow(function() { iter.next(); }); |
41 } | 41 } |
42 | 42 |
43 function assertThrownIteratorIsClosed(iter) { | 43 function assertThrownIteratorIsClosed(iter) { |
44 // TODO(yusukesuzuki): Since status of a thrown generator is "executing", | 44 assertIteratorIsClosed(iter); |
45 // following tests are failed. | |
46 // https://code.google.com/p/v8/issues/detail?id=3096 | |
47 // assertIteratorIsClosed(iter); | |
48 } | 45 } |
49 | 46 |
50 function TestGeneratorResultPrototype() { | 47 function TestGeneratorResultPrototype() { |
51 function* g() { yield 1; } | 48 function* g() { yield 1; } |
52 var iter = g(); | 49 var iter = g(); |
53 var result = iter.next(); | 50 var result = iter.next(); |
54 | 51 |
55 assertSame(Object.prototype, Object.getPrototypeOf(result)); | 52 assertSame(Object.prototype, Object.getPrototypeOf(result)); |
56 property_names = Object.getOwnPropertyNames(result); | 53 property_names = Object.getOwnPropertyNames(result); |
57 property_names.sort(); | 54 property_names.sort(); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 function TestThrowRecursion() { | 686 function TestThrowRecursion() { |
690 function* g() { yield iter.throw(1); } | 687 function* g() { yield iter.throw(1); } |
691 var iter = g(); | 688 var iter = g(); |
692 return iter.next(); | 689 return iter.next(); |
693 } | 690 } |
694 assertThrows(TestNextRecursion, Error); | 691 assertThrows(TestNextRecursion, Error); |
695 assertThrows(TestSendRecursion, Error); | 692 assertThrows(TestSendRecursion, Error); |
696 assertThrows(TestThrowRecursion, Error); | 693 assertThrows(TestThrowRecursion, Error); |
697 } | 694 } |
698 TestRecursion(); | 695 TestRecursion(); |
OLD | NEW |