| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 "and a value or writable attribute, #<Object>", TypeError); | 338 "and a value or writable attribute, #<Object>", TypeError); |
| 339 | 339 |
| 340 | 340 |
| 341 // === SyntaxError === | 341 // === SyntaxError === |
| 342 | 342 |
| 343 // kInvalidRegExpFlags | 343 // kInvalidRegExpFlags |
| 344 test(function() { | 344 test(function() { |
| 345 eval("/a/x.test(\"a\");"); | 345 eval("/a/x.test(\"a\");"); |
| 346 }, "Invalid regular expression flags", SyntaxError); | 346 }, "Invalid regular expression flags", SyntaxError); |
| 347 | 347 |
| 348 //kJsonParseUnexpectedEOS |
| 349 test(function() { |
| 350 JSON.parse("{") |
| 351 }, "Unexpected end of JSON input", SyntaxError); |
| 352 |
| 353 // kJsonParseUnexpectedTokenAt |
| 354 test(function() { |
| 355 JSON.parse("/") |
| 356 }, "Unexpected token / in JSON at position 0", SyntaxError); |
| 357 |
| 358 // kJsonParseUnexpectedTokenNumberAt |
| 359 test(function() { |
| 360 JSON.parse("{ 1") |
| 361 }, "Unexpected number in JSON at position 2", SyntaxError); |
| 362 |
| 363 // kJsonParseUnexpectedTokenStringAt |
| 364 test(function() { |
| 365 JSON.parse('"""') |
| 366 }, "Unexpected string in JSON at position 2", SyntaxError); |
| 367 |
| 348 // kMalformedRegExp | 368 // kMalformedRegExp |
| 349 test(function() { | 369 test(function() { |
| 350 /(/.test("a"); | 370 /(/.test("a"); |
| 351 }, "Invalid regular expression: /(/: Unterminated group", SyntaxError); | 371 }, "Invalid regular expression: /(/: Unterminated group", SyntaxError); |
| 352 | 372 |
| 353 // kParenthesisInArgString | 373 // kParenthesisInArgString |
| 354 test(function() { | 374 test(function() { |
| 355 new Function(")", ""); | 375 new Function(")", ""); |
| 356 }, "Function arg string contains parenthesis", SyntaxError); | 376 }, "Function arg string contains parenthesis", SyntaxError); |
| 357 | 377 |
| 358 // kUnexpectedEOS | |
| 359 test(function() { | |
| 360 JSON.parse("{") | |
| 361 }, "Unexpected end of input", SyntaxError); | |
| 362 | |
| 363 // kUnexpectedToken | |
| 364 test(function() { | |
| 365 JSON.parse("/") | |
| 366 }, "Unexpected token /", SyntaxError); | |
| 367 | |
| 368 // kUnexpectedTokenNumber | |
| 369 test(function() { | |
| 370 JSON.parse("{ 1") | |
| 371 }, "Unexpected number", SyntaxError); | |
| 372 | |
| 373 // kUnexpectedTokenString | |
| 374 test(function() { | |
| 375 JSON.parse('"""') | |
| 376 }, "Unexpected string", SyntaxError); | |
| 377 | |
| 378 | |
| 379 // === ReferenceError === | 378 // === ReferenceError === |
| 380 | 379 |
| 381 // kNotDefined | 380 // kNotDefined |
| 382 test(function() { | 381 test(function() { |
| 383 "use strict"; | 382 "use strict"; |
| 384 o; | 383 o; |
| 385 }, "o is not defined", ReferenceError); | 384 }, "o is not defined", ReferenceError); |
| 386 | 385 |
| 387 // === RangeError === | 386 // === RangeError === |
| 388 | 387 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 Number(1).toString(100); | 446 Number(1).toString(100); |
| 448 }, "toString() radix argument must be between 2 and 36", RangeError); | 447 }, "toString() radix argument must be between 2 and 36", RangeError); |
| 449 | 448 |
| 450 | 449 |
| 451 // === URIError === | 450 // === URIError === |
| 452 | 451 |
| 453 // kURIMalformed | 452 // kURIMalformed |
| 454 test(function() { | 453 test(function() { |
| 455 decodeURI("%%"); | 454 decodeURI("%%"); |
| 456 }, "URI malformed", URIError); | 455 }, "URI malformed", URIError); |
| OLD | NEW |