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 | 5 // Flags: --stack-size=100 --harmony |
6 // Flags: --harmony-simd | 6 // Flags: --harmony-simd |
7 | 7 |
8 function test(f, expected, type) { | 8 function test(f, expected, type) { |
9 try { | 9 try { |
10 f(); | 10 f(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // kDefineDisallowed | 112 // kDefineDisallowed |
113 test(function() { | 113 test(function() { |
114 "use strict"; | 114 "use strict"; |
115 var o = {}; | 115 var o = {}; |
116 Object.preventExtensions(o); | 116 Object.preventExtensions(o); |
117 Object.defineProperty(o, "x", { value: 1 }); | 117 Object.defineProperty(o, "x", { value: 1 }); |
118 }, "Cannot define property:x, object is not extensible.", TypeError); | 118 }, "Cannot define property x, object is not extensible", TypeError); |
119 | 119 |
120 // kFirstArgumentNotRegExp | 120 // kFirstArgumentNotRegExp |
121 test(function() { | 121 test(function() { |
122 "a".startsWith(/a/); | 122 "a".startsWith(/a/); |
123 }, "First argument to String.prototype.startsWith " + | 123 }, "First argument to String.prototype.startsWith " + |
124 "must not be a regular expression", TypeError); | 124 "must not be a regular expression", TypeError); |
125 | 125 |
126 // kFlagsGetterNonObject | 126 // kFlagsGetterNonObject |
127 test(function() { | 127 test(function() { |
128 Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get.call(1); | 128 Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get.call(1); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 test(function() { | 235 test(function() { |
236 Object.defineProperty({}, "x", { get: 1 }); | 236 Object.defineProperty({}, "x", { get: 1 }); |
237 }, "Getter must be a function: 1", TypeError); | 237 }, "Getter must be a function: 1", TypeError); |
238 | 238 |
239 // kObjectNotExtensible | 239 // kObjectNotExtensible |
240 test(function() { | 240 test(function() { |
241 "use strict"; | 241 "use strict"; |
242 var o = {}; | 242 var o = {}; |
243 Object.freeze(o); | 243 Object.freeze(o); |
244 o.a = 1; | 244 o.a = 1; |
245 }, "Can't add property a, object is not extensible", TypeError); | 245 }, "Cannot add property a, object is not extensible", TypeError); |
246 | 246 |
247 // kObjectSetterExpectingFunction | 247 // kObjectSetterExpectingFunction |
248 test(function() { | 248 test(function() { |
249 ({}).__defineSetter__("x", 0); | 249 ({}).__defineSetter__("x", 0); |
250 }, "Object.prototype.__defineSetter__: Expecting function", TypeError); | 250 }, "Object.prototype.__defineSetter__: Expecting function", TypeError); |
251 | 251 |
252 // kObjectSetterCallable | 252 // kObjectSetterCallable |
253 test(function() { | 253 test(function() { |
254 Object.defineProperty({}, "x", { set: 1 }); | 254 Object.defineProperty({}, "x", { set: 1 }); |
255 }, "Setter must be a function: 1", TypeError); | 255 }, "Setter must be a function: 1", TypeError); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 Number(1).toString(100); | 450 Number(1).toString(100); |
451 }, "toString() radix argument must be between 2 and 36", RangeError); | 451 }, "toString() radix argument must be between 2 and 36", RangeError); |
452 | 452 |
453 | 453 |
454 // === URIError === | 454 // === URIError === |
455 | 455 |
456 // kURIMalformed | 456 // kURIMalformed |
457 test(function() { | 457 test(function() { |
458 decodeURI("%%"); | 458 decodeURI("%%"); |
459 }, "URI malformed", URIError); | 459 }, "URI malformed", URIError); |
OLD | NEW |