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