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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 var next_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, | 124 var next_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, |
125 "next"); | 125 "next"); |
126 assertTrue(next_desc !== undefined); | 126 assertTrue(next_desc !== undefined); |
127 assertTrue(next_desc.writable); | 127 assertTrue(next_desc.writable); |
128 assertFalse(next_desc.enumerable); | 128 assertFalse(next_desc.enumerable); |
129 assertTrue(next_desc.configurable); | 129 assertTrue(next_desc.configurable); |
130 | 130 |
131 var throw_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, | 131 var throw_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, |
132 "throw"); | 132 "throw"); |
133 assertTrue(next_desc !== undefined); | 133 assertTrue(throw_desc !== undefined); |
134 assertTrue(next_desc.writable); | 134 assertTrue(throw_desc.writable); |
135 assertFalse(next_desc.enumerable); | 135 assertFalse(throw_desc.enumerable); |
136 assertTrue(next_desc.configurable); | 136 assertTrue(throw_desc.configurable); |
137 | 137 |
138 var iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, | 138 var iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, |
139 Symbol.iterator); | 139 Symbol.iterator); |
140 assertTrue(iterator_desc !== undefined); | 140 assertTrue(iterator_desc !== undefined); |
141 assertFalse(iterator_desc.writable); | 141 assertFalse(iterator_desc.writable); |
142 assertFalse(iterator_desc.enumerable); | 142 assertFalse(iterator_desc.enumerable); |
143 assertFalse(iterator_desc.configurable); | 143 assertFalse(iterator_desc.configurable); |
144 | 144 |
145 // The generator object's "iterator" function is just the identity. | 145 // The generator object's "iterator" function is just the identity. |
146 assertSame(iterator_desc.value.call(42), 42); | 146 assertSame(iterator_desc.value.call(42), 42); |
(...skipping 25 matching lines...) Expand all Loading... |
172 function TestPerGeneratorPrototype() { | 172 function TestPerGeneratorPrototype() { |
173 assertTrue((function*(){}).prototype !== (function*(){}).prototype); | 173 assertTrue((function*(){}).prototype !== (function*(){}).prototype); |
174 assertTrue((function*(){}).prototype !== g.prototype); | 174 assertTrue((function*(){}).prototype !== g.prototype); |
175 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype)); | 175 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype)); |
176 assertTrue(!(g.prototype instanceof Function)); | 176 assertTrue(!(g.prototype instanceof Function)); |
177 assertSame(typeof (g.prototype), "object"); | 177 assertSame(typeof (g.prototype), "object"); |
178 | 178 |
179 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype)); | 179 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype)); |
180 } | 180 } |
181 TestPerGeneratorPrototype(); | 181 TestPerGeneratorPrototype(); |
OLD | NEW |