Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: test/mjsunit/messages.js

Issue 1523753002: [es6] Correct Function.prototype.apply, Reflect.construct and Reflect.apply. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Mark mjsunit/apply as TIMEOUT (for tsan). Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/apply.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
60 // kCalledOnNullOrUndefined 72 // kCalledOnNullOrUndefined
61 test(function() { 73 test(function() {
62 Array.prototype.shift.call(null); 74 Array.prototype.shift.call(null);
63 }, "Array.prototype.shift called on null or undefined", TypeError); 75 }, "Array.prototype.shift called on null or undefined", TypeError);
64 76
65 // kCannotFreezeArrayBufferView 77 // kCannotFreezeArrayBufferView
66 test(function() { 78 test(function() {
67 Object.freeze(new Uint16Array(1)); 79 Object.freeze(new Uint16Array(1));
68 }, "Cannot freeze array buffer views with elements", TypeError); 80 }, "Cannot freeze array buffer views with elements", TypeError);
69 81
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 test(function() { 335 test(function() {
324 Array.prototype.toString.call(null); 336 Array.prototype.toString.call(null);
325 }, "Cannot convert undefined or null to object", TypeError); 337 }, "Cannot convert undefined or null to object", TypeError);
326 338
327 // kValueAndAccessor 339 // kValueAndAccessor
328 test(function() { 340 test(function() {
329 Object.defineProperty({}, "x", { get: function(){}, value: 1}); 341 Object.defineProperty({}, "x", { get: function(){}, value: 1});
330 }, "Invalid property descriptor. Cannot both specify accessors " + 342 }, "Invalid property descriptor. Cannot both specify accessors " +
331 "and a value or writable attribute, #<Object>", TypeError); 343 "and a value or writable attribute, #<Object>", TypeError);
332 344
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
346 345
347 // === SyntaxError === 346 // === SyntaxError ===
348 347
349 // kInvalidRegExpFlags 348 // kInvalidRegExpFlags
350 test(function() { 349 test(function() {
351 eval("/a/x.test(\"a\");"); 350 eval("/a/x.test(\"a\");");
352 }, "Invalid regular expression flags", SyntaxError); 351 }, "Invalid regular expression flags", SyntaxError);
353 352
354 // kMalformedRegExp 353 // kMalformedRegExp
355 test(function() { 354 test(function() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 Number(1).toString(100); 452 Number(1).toString(100);
454 }, "toString() radix argument must be between 2 and 36", RangeError); 453 }, "toString() radix argument must be between 2 and 36", RangeError);
455 454
456 455
457 // === URIError === 456 // === URIError ===
458 457
459 // kURIMalformed 458 // kURIMalformed
460 test(function() { 459 test(function() {
461 decodeURI("%%"); 460 decodeURI("%%");
462 }, "URI malformed", URIError); 461 }, "URI malformed", URIError);
OLDNEW
« no previous file with comments | « test/mjsunit/apply.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698