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 |
7 | 7 |
8 function test(f, expected, type) { | 8 function test(f, expected, type) { |
9 try { | 9 try { |
10 f(); | 10 f(); |
11 } catch (e) { | 11 } catch (e) { |
12 assertInstanceof(e, type); | 12 assertInstanceof(e, type); |
13 assertEquals(expected, e.message); | 13 assertEquals(expected, e.message); |
14 return; | 14 return; |
15 } | 15 } |
16 assertUnreachable("Exception expected"); | 16 assertUnreachable("Exception expected"); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 }, "'caller', 'callee', and 'arguments' properties may not be accessed on " + | 298 }, "'caller', 'callee', and 'arguments' properties may not be accessed on " + |
299 "strict mode functions or the arguments objects for calls to them", | 299 "strict mode functions or the arguments objects for calls to them", |
300 TypeError); | 300 TypeError); |
301 | 301 |
302 // kStrictReadOnlyProperty | 302 // kStrictReadOnlyProperty |
303 test(function() { | 303 test(function() { |
304 "use strict"; | 304 "use strict"; |
305 (1).a = 1; | 305 (1).a = 1; |
306 }, "Cannot create property 'a' on number '1'", TypeError); | 306 }, "Cannot create property 'a' on number '1'", TypeError); |
307 | 307 |
308 // kStrongImplicitCast | |
309 test(function() { | |
310 "use strong"; | |
311 "a" + 1; | |
312 }, "In strong mode, implicit conversions are deprecated", TypeError); | |
313 | |
314 // kSymbolToString | 308 // kSymbolToString |
315 test(function() { | 309 test(function() { |
316 "" + Symbol(); | 310 "" + Symbol(); |
317 }, "Cannot convert a Symbol value to a string", TypeError); | 311 }, "Cannot convert a Symbol value to a string", TypeError); |
318 | 312 |
319 // kSymbolToNumber | 313 // kSymbolToNumber |
320 test(function() { | 314 test(function() { |
321 1 + Symbol(); | 315 1 + Symbol(); |
322 }, "Cannot convert a Symbol value to a number", TypeError); | 316 }, "Cannot convert a Symbol value to a number", TypeError); |
323 | 317 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 Number(1).toString(100); | 440 Number(1).toString(100); |
447 }, "toString() radix argument must be between 2 and 36", RangeError); | 441 }, "toString() radix argument must be between 2 and 36", RangeError); |
448 | 442 |
449 | 443 |
450 // === URIError === | 444 // === URIError === |
451 | 445 |
452 // kURIMalformed | 446 // kURIMalformed |
453 test(function() { | 447 test(function() { |
454 decodeURI("%%"); | 448 decodeURI("%%"); |
455 }, "URI malformed", URIError); | 449 }, "URI malformed", URIError); |
OLD | NEW |