OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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: --allow-natives-syntax --harmony-tailcalls | 5 // Flags: --allow-natives-syntax --harmony-tailcalls |
6 | 6 |
7 | 7 |
8 Error.prepareStackTrace = (error,stack) => { | 8 Error.prepareStackTrace = (error,stack) => { |
9 error.strace = stack; | 9 error.strace = stack; |
10 return error.message + "\n at " + stack.join("\n at "); | 10 return error.message + "\n at " + stack.join("\n at "); |
11 } | 11 } |
12 | 12 |
13 var verbose = typeof(arguments) !== "undefined" && arguments.indexOf("-v") >= 0; | 13 var verbose = typeof(arguments) !== "undefined" && arguments.indexOf("-v") >= 0; |
14 | 14 |
15 function checkStackTrace(expected) { | 15 function checkStackTrace(expected) { |
16 var e = new Error(); | 16 var e = new Error(); |
17 e.stack; // prepare stack trace | 17 e.stack; // prepare stack trace |
18 var stack = e.strace; | 18 var stack = e.strace; |
19 assertEquals("checkStackTrace", stack[0].getFunctionName()); | 19 assertEquals("checkStackTrace", stack[0].getFunctionName()); |
20 for (var i = 0; i < expected.length; i++) { | 20 for (var i = 0; i < expected.length; i++) { |
21 assertEquals(expected[i].name, stack[i + 1].getFunctionName()); | 21 assertEquals(expected[i].name, stack[i + 1].getFunctionName()); |
22 } | 22 } |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 var CAN_INLINE_COMMENT = "// Let it be inlined."; | 26 var CAN_INLINE_COMMENT = "// Let it be inlined."; |
27 var DONT_INLINE_COMMENT = (function() { | 27 var DONT_INLINE_COMMENT = (function() { |
28 var line = "// Don't inline. Don't inline. Don't inline. Don't inline."; | 28 var line = "1"; |
29 for (var i = 0; i < 4; i++) { | 29 for (var i = 0; i < 200; ++i) { |
30 line += "\n " + line; | 30 line += "," + i; |
31 } | 31 } |
| 32 line += ";\n"; |
32 return line; | 33 return line; |
33 })(); | 34 })(); |
34 | 35 |
35 | 36 |
36 function ident_source(source, ident) { | 37 function ident_source(source, ident) { |
37 ident = " ".repeat(ident); | 38 ident = " ".repeat(ident); |
38 return ident + source.replace(/\n/gi, "\n" + ident); | 39 return ident + source.replace(/\n/gi, "\n" + ident); |
39 } | 40 } |
40 | 41 |
41 var SHARDS_COUNT = 10; | 42 var SHARDS_COUNT = 10; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 }); | 414 }); |
414 }); | 415 }); |
415 }); | 416 }); |
416 if (verbose) { | 417 if (verbose) { |
417 print("Number of tests executed: " + tests_executed); | 418 print("Number of tests executed: " + tests_executed); |
418 } | 419 } |
419 } | 420 } |
420 | 421 |
421 // Uncomment to run all the tests at once or use shard runners. | 422 // Uncomment to run all the tests at once or use shard runners. |
422 //run_tests(); | 423 //run_tests(); |
OLD | NEW |