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