| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // kCalledNonCallable | 50 // kCalledNonCallable |
| 51 test(function() { | 51 test(function() { |
| 52 [].forEach(1); | 52 [].forEach(1); |
| 53 }, "1 is not a function", TypeError); | 53 }, "1 is not a function", TypeError); |
| 54 | 54 |
| 55 // kCalledOnNonObject | 55 // kCalledOnNonObject |
| 56 test(function() { | 56 test(function() { |
| 57 Object.defineProperty(1, "x", {}); | 57 Object.defineProperty(1, "x", {}); |
| 58 }, "Object.defineProperty called on non-object", TypeError); | 58 }, "Object.defineProperty called on non-object", TypeError); |
| 59 | 59 |
| 60 test(function() { | |
| 61 (function() {}).apply({}, 1); | |
| 62 }, "CreateListFromArrayLike called on non-object", TypeError); | |
| 63 | |
| 64 test(function() { | |
| 65 Reflect.apply(function() {}, {}, 1); | |
| 66 }, "CreateListFromArrayLike called on non-object", TypeError); | |
| 67 | |
| 68 test(function() { | |
| 69 Reflect.construct(function() {}, 1); | |
| 70 }, "CreateListFromArrayLike called on non-object", TypeError); | |
| 71 | |
| 72 // kCalledOnNullOrUndefined | 60 // kCalledOnNullOrUndefined |
| 73 test(function() { | 61 test(function() { |
| 74 Array.prototype.shift.call(null); | 62 Array.prototype.shift.call(null); |
| 75 }, "Array.prototype.shift called on null or undefined", TypeError); | 63 }, "Array.prototype.shift called on null or undefined", TypeError); |
| 76 | 64 |
| 77 // kCannotFreezeArrayBufferView | 65 // kCannotFreezeArrayBufferView |
| 78 test(function() { | 66 test(function() { |
| 79 Object.freeze(new Uint16Array(1)); | 67 Object.freeze(new Uint16Array(1)); |
| 80 }, "Cannot freeze array buffer views with elements", TypeError); | 68 }, "Cannot freeze array buffer views with elements", TypeError); |
| 81 | 69 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 test(function() { | 323 test(function() { |
| 336 Array.prototype.toString.call(null); | 324 Array.prototype.toString.call(null); |
| 337 }, "Cannot convert undefined or null to object", TypeError); | 325 }, "Cannot convert undefined or null to object", TypeError); |
| 338 | 326 |
| 339 // kValueAndAccessor | 327 // kValueAndAccessor |
| 340 test(function() { | 328 test(function() { |
| 341 Object.defineProperty({}, "x", { get: function(){}, value: 1}); | 329 Object.defineProperty({}, "x", { get: function(){}, value: 1}); |
| 342 }, "Invalid property descriptor. Cannot both specify accessors " + | 330 }, "Invalid property descriptor. Cannot both specify accessors " + |
| 343 "and a value or writable attribute, #<Object>", TypeError); | 331 "and a value or writable attribute, #<Object>", TypeError); |
| 344 | 332 |
| 333 // kWrongArgs |
| 334 test(function() { |
| 335 (function() {}).apply({}, 1); |
| 336 }, "Function.prototype.apply: Arguments list has wrong type", TypeError); |
| 337 |
| 338 test(function() { |
| 339 Reflect.apply(function() {}, {}, 1); |
| 340 }, "Reflect.apply: Arguments list has wrong type", TypeError); |
| 341 |
| 342 test(function() { |
| 343 Reflect.construct(function() {}, 1); |
| 344 }, "Reflect.construct: Arguments list has wrong type", TypeError); |
| 345 |
| 345 | 346 |
| 346 // === SyntaxError === | 347 // === SyntaxError === |
| 347 | 348 |
| 348 // kInvalidRegExpFlags | 349 // kInvalidRegExpFlags |
| 349 test(function() { | 350 test(function() { |
| 350 eval("/a/x.test(\"a\");"); | 351 eval("/a/x.test(\"a\");"); |
| 351 }, "Invalid regular expression flags", SyntaxError); | 352 }, "Invalid regular expression flags", SyntaxError); |
| 352 | 353 |
| 353 // kMalformedRegExp | 354 // kMalformedRegExp |
| 354 test(function() { | 355 test(function() { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 Number(1).toString(100); | 453 Number(1).toString(100); |
| 453 }, "toString() radix argument must be between 2 and 36", RangeError); | 454 }, "toString() radix argument must be between 2 and 36", RangeError); |
| 454 | 455 |
| 455 | 456 |
| 456 // === URIError === | 457 // === URIError === |
| 457 | 458 |
| 458 // kURIMalformed | 459 // kURIMalformed |
| 459 test(function() { | 460 test(function() { |
| 460 decodeURI("%%"); | 461 decodeURI("%%"); |
| 461 }, "URI malformed", URIError); | 462 }, "URI malformed", URIError); |
| OLD | NEW |