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 function TestStringPrototypeIterator() { | 5 function TestStringPrototypeIterator() { |
6 assertTrue(String.prototype.hasOwnProperty(Symbol.iterator)); | 6 assertTrue(String.prototype.hasOwnProperty(Symbol.iterator)); |
7 assertFalse("".hasOwnProperty(Symbol.iterator)); | 7 assertFalse("".hasOwnProperty(Symbol.iterator)); |
8 assertFalse("".propertyIsEnumerable(Symbol.iterator)); | 8 assertFalse("".propertyIsEnumerable(Symbol.iterator)); |
9 } | 9 } |
10 TestStringPrototypeIterator(); | 10 TestStringPrototypeIterator(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 TestForOf(); | 85 TestForOf(); |
86 | 86 |
87 | 87 |
88 function TestNonOwnSlots() { | 88 function TestNonOwnSlots() { |
89 var iterator = ""[Symbol.iterator](); | 89 var iterator = ""[Symbol.iterator](); |
90 var object = {__proto__: iterator}; | 90 var object = {__proto__: iterator}; |
91 | 91 |
92 assertThrows(function() { object.next(); }, TypeError); | 92 assertThrows(function() { object.next(); }, TypeError); |
93 } | 93 } |
94 TestNonOwnSlots(); | 94 TestNonOwnSlots(); |
| 95 |
| 96 |
| 97 function TestSlicedStringRegression() { |
| 98 var long_string = "abcdefhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| 99 var sliced_string = long_string.substring(1); |
| 100 var iterator = sliced_string[Symbol.iterator](); |
| 101 } |
| 102 TestSlicedStringRegression(); |
OLD | NEW |