Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 1 | // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | |
| 6 | function test(expectation, f) { |
| 7 | var stack; |
| 8 | try { |
| 9 | f(); |
| 10 | } catch (e) { |
| 11 | stack = e.stack; |
| 12 | } |
| 13 | print(stack); |
| 14 | assertTrue(stack.indexOf("at eval (evaltest:" + expectation + ")") > 0); |
| 15 | } |
| 16 | |
| 17 | test("1:5", new Function( |
| 18 | '1 + reference_error //@ sourceURL=evaltest')); |
| 19 | test("2:6", new Function( |
| 20 | 'x', '\n 1 + reference_error //@ sourceURL=evaltest')); |
| 21 | test("2:6", new Function( |
| 22 | 'x\n\n', "z//\n", "y", '\n 1 + reference_error //@ sourceURL=evaltest')); |
| 23 | test("1:5", new Function( |
| 24 | 'x/*', "z//\n", "y*/", '1 + reference_error //@ sourceURL=evaltest')); |
| 25 | test("2:6", eval( |
| 26 | '(function () {\n 1 + reference_error //@ sourceURL=evaltest\n})')); |