blob: b15601386aba48d3486b011d0a5a38dcba40a087 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// 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
6function 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
17test("1:5", new Function(
18 '1 + reference_error //@ sourceURL=evaltest'));
19test("2:6", new Function(
20 'x', '\n 1 + reference_error //@ sourceURL=evaltest'));
21test("2:6", new Function(
22 'x\n\n', "z//\n", "y", '\n 1 + reference_error //@ sourceURL=evaltest'));
23test("1:5", new Function(
24 'x/*', "z//\n", "y*/", '1 + reference_error //@ sourceURL=evaltest'));
25test("2:6", eval(
26 '(function () {\n 1 + reference_error //@ sourceURL=evaltest\n})'));