OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-iteration | |
6 | |
7 | 5 |
8 function TestStringPrototypeIterator() { | 6 function TestStringPrototypeIterator() { |
9 assertTrue(String.prototype.hasOwnProperty(Symbol.iterator)); | 7 assertTrue(String.prototype.hasOwnProperty(Symbol.iterator)); |
10 assertFalse("".hasOwnProperty(Symbol.iterator)); | 8 assertFalse("".hasOwnProperty(Symbol.iterator)); |
11 assertFalse("".propertyIsEnumerable(Symbol.iterator)); | 9 assertFalse("".propertyIsEnumerable(Symbol.iterator)); |
12 } | 10 } |
13 TestStringPrototypeIterator(); | 11 TestStringPrototypeIterator(); |
14 | 12 |
15 | 13 |
16 function assertIteratorResult(value, done, result) { | 14 function assertIteratorResult(value, done, result) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 TestForOf(); | 80 TestForOf(); |
83 | 81 |
84 | 82 |
85 function TestNonOwnSlots() { | 83 function TestNonOwnSlots() { |
86 var iterator = ""[Symbol.iterator](); | 84 var iterator = ""[Symbol.iterator](); |
87 var object = {__proto__: iterator}; | 85 var object = {__proto__: iterator}; |
88 | 86 |
89 assertThrows(function() { object.next(); }, TypeError); | 87 assertThrows(function() { object.next(); }, TypeError); |
90 } | 88 } |
91 TestNonOwnSlots(); | 89 TestNonOwnSlots(); |
OLD | NEW |