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-arrays | 5 // Flags: --stack-size=100 --harmony --harmony-reflect --harmony-arrays |
6 // Flags: --harmony-regexps --strong-mode | 6 // Flags: --harmony-regexps --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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 test(function() { | 347 test(function() { |
348 Reflect.apply(function() {}, {}, 1); | 348 Reflect.apply(function() {}, {}, 1); |
349 }, "Reflect.apply: Arguments list has wrong type", TypeError); | 349 }, "Reflect.apply: Arguments list has wrong type", TypeError); |
350 | 350 |
351 test(function() { | 351 test(function() { |
352 Reflect.construct(function() {}, 1); | 352 Reflect.construct(function() {}, 1); |
353 }, "Reflect.construct: Arguments list has wrong type", TypeError); | 353 }, "Reflect.construct: Arguments list has wrong type", TypeError); |
354 | 354 |
355 | 355 |
356 //=== SyntaxError === | 356 // === SyntaxError === |
357 | 357 |
| 358 // kInvalidRegExpFlags |
| 359 test(function() { |
| 360 /a/x.test("a"); |
| 361 }, "Invalid flags supplied to RegExp constructor 'x'", SyntaxError); |
| 362 |
| 363 // kMalformedRegExp |
| 364 test(function() { |
| 365 /(/.test("a"); |
| 366 }, "Invalid regular expression: /(/: Unterminated group", SyntaxError); |
| 367 |
| 368 // kParenthesisInArgString |
358 test(function() { | 369 test(function() { |
359 new Function(")", ""); | 370 new Function(")", ""); |
360 }, "Function arg string contains parenthesis", SyntaxError); | 371 }, "Function arg string contains parenthesis", SyntaxError); |
361 | 372 |
| 373 // kUnexpectedEOS |
| 374 test(function() { |
| 375 JSON.parse("{") |
| 376 }, "Unexpected end of input", SyntaxError); |
| 377 |
| 378 // kUnexpectedToken |
| 379 test(function() { |
| 380 JSON.parse("/") |
| 381 }, "Unexpected token /", SyntaxError); |
| 382 |
| 383 // kUnexpectedTokenNumber |
| 384 test(function() { |
| 385 JSON.parse("{ 1") |
| 386 }, "Unexpected number", SyntaxError); |
| 387 |
| 388 // kUnexpectedTokenString |
| 389 test(function() { |
| 390 JSON.parse('"""') |
| 391 }, "Unexpected string", SyntaxError); |
| 392 |
362 | 393 |
363 // === ReferenceError === | 394 // === ReferenceError === |
364 | 395 |
| 396 // kNotDefined |
365 test(function() { | 397 test(function() { |
366 "use strict"; | 398 "use strict"; |
367 o; | 399 o; |
368 }, "o is not defined", ReferenceError); | 400 }, "o is not defined", ReferenceError); |
369 | 401 |
370 // === RangeError === | 402 // === RangeError === |
371 | 403 |
372 // kArrayLengthOutOfRange | 404 // kArrayLengthOutOfRange |
373 test(function() { | 405 test(function() { |
374 "use strict"; | 406 "use strict"; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 Number(1).toString(100); | 462 Number(1).toString(100); |
431 }, "toString() radix argument must be between 2 and 36", RangeError); | 463 }, "toString() radix argument must be between 2 and 36", RangeError); |
432 | 464 |
433 | 465 |
434 // === URIError === | 466 // === URIError === |
435 | 467 |
436 // kURIMalformed | 468 // kURIMalformed |
437 test(function() { | 469 test(function() { |
438 decodeURI("%%"); | 470 decodeURI("%%"); |
439 }, "URI malformed", URIError); | 471 }, "URI malformed", URIError); |
OLD | NEW |