OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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: --stack-size=100 --harmony --harmony-reflect --harmony-regexps | 5 // Flags: --stack-size=100 --harmony --harmony-reflect --harmony-regexps |
6 // Flags: --harmony-simd --strong-mode | 6 // Flags: --harmony-simd --strong-mode |
7 | 7 |
8 function test(f, expected, type) { | 8 function test(f, expected, type) { |
9 try { | 9 try { |
10 f(); | 10 f(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // kConstructorNotFunction | 102 // kConstructorNotFunction |
103 test(function() { | 103 test(function() { |
104 Uint16Array(1); | 104 Uint16Array(1); |
105 }, "Constructor Uint16Array requires 'new'", TypeError); | 105 }, "Constructor Uint16Array requires 'new'", TypeError); |
106 | 106 |
107 // kDataViewNotArrayBuffer | 107 // kDataViewNotArrayBuffer |
108 test(function() { | 108 test(function() { |
109 new DataView(1); | 109 new DataView(1); |
110 }, "First argument to DataView constructor must be an ArrayBuffer", TypeError); | 110 }, "First argument to DataView constructor must be an ArrayBuffer", TypeError); |
111 | 111 |
| 112 // kDateType |
| 113 test(function() { |
| 114 Date.prototype.setYear.call({}, 1); |
| 115 }, "this is not a Date object.", TypeError); |
| 116 |
112 // kDefineDisallowed | 117 // kDefineDisallowed |
113 test(function() { | 118 test(function() { |
114 "use strict"; | 119 "use strict"; |
115 var o = {}; | 120 var o = {}; |
116 Object.preventExtensions(o); | 121 Object.preventExtensions(o); |
117 Object.defineProperty(o, "x", { value: 1 }); | 122 Object.defineProperty(o, "x", { value: 1 }); |
118 }, "Cannot define property:x, object is not extensible.", TypeError); | 123 }, "Cannot define property:x, object is not extensible.", TypeError); |
119 | 124 |
120 // kFirstArgumentNotRegExp | 125 // kFirstArgumentNotRegExp |
121 test(function() { | 126 test(function() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 new Map([1]); | 182 new Map([1]); |
178 }, "Iterator value 1 is not an entry object", TypeError); | 183 }, "Iterator value 1 is not an entry object", TypeError); |
179 | 184 |
180 // kNotConstructor | 185 // kNotConstructor |
181 test(function() { | 186 test(function() { |
182 new Symbol(); | 187 new Symbol(); |
183 }, "Symbol is not a constructor", TypeError); | 188 }, "Symbol is not a constructor", TypeError); |
184 | 189 |
185 // kNotDateObject | 190 // kNotDateObject |
186 test(function() { | 191 test(function() { |
187 Date.prototype.getHours.call(1); | 192 Date.prototype.setHours.call(1); |
188 }, "this is not a Date object.", TypeError); | 193 }, "this is not a Date object.", TypeError); |
189 | 194 |
190 // kNotGeneric | 195 // kNotGeneric |
191 test(function() { | 196 test(function() { |
192 String.prototype.toString.call(1); | 197 String.prototype.toString.call(1); |
193 }, "String.prototype.toString is not generic", TypeError); | 198 }, "String.prototype.toString is not generic", TypeError); |
194 | 199 |
195 test(function() { | 200 test(function() { |
196 String.prototype.valueOf.call(1); | 201 String.prototype.valueOf.call(1); |
197 }, "String.prototype.valueOf is not generic", TypeError); | 202 }, "String.prototype.valueOf is not generic", TypeError); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 Number(1).toString(100); | 452 Number(1).toString(100); |
448 }, "toString() radix argument must be between 2 and 36", RangeError); | 453 }, "toString() radix argument must be between 2 and 36", RangeError); |
449 | 454 |
450 | 455 |
451 // === URIError === | 456 // === URIError === |
452 | 457 |
453 // kURIMalformed | 458 // kURIMalformed |
454 test(function() { | 459 test(function() { |
455 decodeURI("%%"); | 460 decodeURI("%%"); |
456 }, "URI malformed", URIError); | 461 }, "URI malformed", URIError); |
OLD | NEW |