| 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 | 6 |
| 7 function test(f, expected, type) { | 7 function test(f, expected, type) { |
| 8 try { | 8 try { |
| 9 f(); | 9 f(); |
| 10 } catch (e) { | 10 } catch (e) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 test(function() { | 185 test(function() { |
| 186 new Symbol(); | 186 new Symbol(); |
| 187 }, "Symbol is not a constructor", TypeError); | 187 }, "Symbol is not a constructor", TypeError); |
| 188 | 188 |
| 189 // kNotDateObject | 189 // kNotDateObject |
| 190 test(function() { | 190 test(function() { |
| 191 Date.prototype.getHours.call(1); | 191 Date.prototype.getHours.call(1); |
| 192 }, "this is not a Date object.", TypeError); | 192 }, "this is not a Date object.", TypeError); |
| 193 | 193 |
| 194 // kNotGeneric | 194 // kNotGeneric |
| 195 test(() => String.prototype.toString.call(1), | 195 test(function() { |
| 196 "String.prototype.toString requires that 'this' be a String", | 196 String.prototype.toString.call(1); |
| 197 TypeError); | 197 }, "String.prototype.toString is not generic", TypeError); |
| 198 | 198 |
| 199 test(() => String.prototype.valueOf.call(1), | 199 test(function() { |
| 200 "String.prototype.valueOf requires that 'this' be a String", | 200 String.prototype.valueOf.call(1); |
| 201 TypeError); | 201 }, "String.prototype.valueOf is not generic", TypeError); |
| 202 | 202 |
| 203 test(() => Boolean.prototype.toString.call(1), | 203 test(function() { |
| 204 "Boolean.prototype.toString requires that 'this' be a Boolean", | 204 Boolean.prototype.toString.call(1); |
| 205 TypeError); | 205 }, "Boolean.prototype.toString is not generic", TypeError); |
| 206 | 206 |
| 207 test(() => Boolean.prototype.valueOf.call(1), | 207 test(function() { |
| 208 "Boolean.prototype.valueOf requires that 'this' be a Boolean", | 208 Boolean.prototype.valueOf.call(1); |
| 209 TypeError); | 209 }, "Boolean.prototype.valueOf is not generic", TypeError); |
| 210 | 210 |
| 211 test(() => Number.prototype.toString.call({}), | 211 test(function() { |
| 212 "Number.prototype.toString requires that 'this' be a Number", | 212 Number.prototype.toString.call({}); |
| 213 TypeError); | 213 }, "Number.prototype.toString is not generic", TypeError); |
| 214 | 214 |
| 215 test(() => Number.prototype.valueOf.call({}), | 215 test(function() { |
| 216 "Number.prototype.valueOf requires that 'this' be a Number", | 216 Number.prototype.valueOf.call({}); |
| 217 TypeError); | 217 }, "Number.prototype.valueOf is not generic", TypeError); |
| 218 | 218 |
| 219 test(() => Function.prototype.toString.call(1), | 219 test(function() { |
| 220 "Function.prototype.toString requires that 'this' be a Function", | 220 Function.prototype.toString.call(1); |
| 221 TypeError); | 221 }, "Function.prototype.toString is not generic", TypeError); |
| 222 | 222 |
| 223 // kNotTypedArray | 223 // kNotTypedArray |
| 224 test(function() { | 224 test(function() { |
| 225 Uint16Array.prototype.forEach.call(1); | 225 Uint16Array.prototype.forEach.call(1); |
| 226 }, "this is not a typed array.", TypeError); | 226 }, "this is not a typed array.", TypeError); |
| 227 | 227 |
| 228 // kObjectGetterExpectingFunction | 228 // kObjectGetterExpectingFunction |
| 229 test(function() { | 229 test(function() { |
| 230 ({}).__defineGetter__("x", 0); | 230 ({}).__defineGetter__("x", 0); |
| 231 }, "Object.prototype.__defineGetter__: Expecting function", TypeError); | 231 }, "Object.prototype.__defineGetter__: Expecting function", TypeError); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 Number(1).toString(100); | 449 Number(1).toString(100); |
| 450 }, "toString() radix argument must be between 2 and 36", RangeError); | 450 }, "toString() radix argument must be between 2 and 36", RangeError); |
| 451 | 451 |
| 452 | 452 |
| 453 // === URIError === | 453 // === URIError === |
| 454 | 454 |
| 455 // kURIMalformed | 455 // kURIMalformed |
| 456 test(function() { | 456 test(function() { |
| 457 decodeURI("%%"); | 457 decodeURI("%%"); |
| 458 }, "URI malformed", URIError); | 458 }, "URI malformed", URIError); |
| OLD | NEW |