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 | |
117 // kDefineDisallowed | 112 // kDefineDisallowed |
118 test(function() { | 113 test(function() { |
119 "use strict"; | 114 "use strict"; |
120 var o = {}; | 115 var o = {}; |
121 Object.preventExtensions(o); | 116 Object.preventExtensions(o); |
122 Object.defineProperty(o, "x", { value: 1 }); | 117 Object.defineProperty(o, "x", { value: 1 }); |
123 }, "Cannot define property:x, object is not extensible.", TypeError); | 118 }, "Cannot define property:x, object is not extensible.", TypeError); |
124 | 119 |
125 // kFirstArgumentNotRegExp | 120 // kFirstArgumentNotRegExp |
126 test(function() { | 121 test(function() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 new Map([1]); | 177 new Map([1]); |
183 }, "Iterator value 1 is not an entry object", TypeError); | 178 }, "Iterator value 1 is not an entry object", TypeError); |
184 | 179 |
185 // kNotConstructor | 180 // kNotConstructor |
186 test(function() { | 181 test(function() { |
187 new Symbol(); | 182 new Symbol(); |
188 }, "Symbol is not a constructor", TypeError); | 183 }, "Symbol is not a constructor", TypeError); |
189 | 184 |
190 // kNotDateObject | 185 // kNotDateObject |
191 test(function() { | 186 test(function() { |
192 Date.prototype.setHours.call(1); | 187 Date.prototype.getHours.call(1); |
193 }, "this is not a Date object.", TypeError); | 188 }, "this is not a Date object.", TypeError); |
194 | 189 |
195 // kNotGeneric | 190 // kNotGeneric |
196 test(function() { | 191 test(function() { |
197 String.prototype.toString.call(1); | 192 String.prototype.toString.call(1); |
198 }, "String.prototype.toString is not generic", TypeError); | 193 }, "String.prototype.toString is not generic", TypeError); |
199 | 194 |
200 test(function() { | 195 test(function() { |
201 String.prototype.valueOf.call(1); | 196 String.prototype.valueOf.call(1); |
202 }, "String.prototype.valueOf is not generic", TypeError); | 197 }, "String.prototype.valueOf is not generic", TypeError); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 Number(1).toString(100); | 447 Number(1).toString(100); |
453 }, "toString() radix argument must be between 2 and 36", RangeError); | 448 }, "toString() radix argument must be between 2 and 36", RangeError); |
454 | 449 |
455 | 450 |
456 // === URIError === | 451 // === URIError === |
457 | 452 |
458 // kURIMalformed | 453 // kURIMalformed |
459 test(function() { | 454 test(function() { |
460 decodeURI("%%"); | 455 decodeURI("%%"); |
461 }, "URI malformed", URIError); | 456 }, "URI malformed", URIError); |
OLD | NEW |