OLD | NEW |
1 // Copyright 2014 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 | 5 |
6 function test(expectation, f) { | 6 function test(expectation, f) { |
7 var stack; | 7 var stack; |
8 try { | 8 try { |
9 f(); | 9 f(); |
10 } catch (e) { | 10 } catch (e) { |
11 stack = e.stack; | 11 stack = e.stack; |
12 } | 12 } |
13 print(stack); | |
14 assertTrue(stack.indexOf("at eval (evaltest:" + expectation + ")") > 0); | 13 assertTrue(stack.indexOf("at eval (evaltest:" + expectation + ")") > 0); |
15 } | 14 } |
16 | 15 |
17 test("1:5", new Function( | 16 /* |
| 17 (function() { |
| 18 1 + reference_error //@ sourceURL=evaltest |
| 19 }) |
| 20 */ |
| 21 test("2:5", new Function( |
18 '1 + reference_error //@ sourceURL=evaltest')); | 22 '1 + reference_error //@ sourceURL=evaltest')); |
19 test("2:6", new Function( | 23 /* |
| 24 (function(x |
| 25 /\**\/) { |
| 26 |
| 27 1 + reference_error //@ sourceURL=evaltest |
| 28 }) |
| 29 */ |
| 30 test("4:6", new Function( |
20 'x', '\n 1 + reference_error //@ sourceURL=evaltest')); | 31 'x', '\n 1 + reference_error //@ sourceURL=evaltest')); |
21 test("2:6", new Function( | 32 /* |
| 33 (function(x |
| 34 |
| 35 ,z// |
| 36 ,y |
| 37 /\**\/) { |
| 38 |
| 39 1 + reference_error //@ sourceURL=evaltest |
| 40 }) |
| 41 */ |
| 42 test("7:6", new Function( |
22 'x\n\n', "z//\n", "y", '\n 1 + reference_error //@ sourceURL=evaltest')); | 43 'x\n\n', "z//\n", "y", '\n 1 + reference_error //@ sourceURL=evaltest')); |
23 test("1:5", new Function( | 44 /* |
| 45 (function(x/\*,z// |
| 46 ,y*\/ |
| 47 /\**\/) { |
| 48 1 + reference_error //@ sourceURL=evaltest |
| 49 }) |
| 50 */ |
| 51 test("4:5", new Function( |
24 'x/*', "z//\n", "y*/", '1 + reference_error //@ sourceURL=evaltest')); | 52 'x/*', "z//\n", "y*/", '1 + reference_error //@ sourceURL=evaltest')); |
| 53 /* |
| 54 (function () { |
| 55 1 + reference_error //@ sourceURL=evaltest5 |
| 56 }) |
| 57 */ |
25 test("2:6", eval( | 58 test("2:6", eval( |
26 '(function () {\n 1 + reference_error //@ sourceURL=evaltest\n})')); | 59 '(function () {\n 1 + reference_error //@ sourceURL=evaltest\n})')); |
OLD | NEW |