v8/test/mjsunit/regress/regress-crbug-109362.js
yangguo@chromium.org 1dbd6369b1 Correctly compute line numbers in functions from the function constructor.
R=aandrey@chromium.org
BUG=chromium:109362
LOG=Y

Review URL: https://codereview.chromium.org/701093003

Cr-Commit-Position: refs/heads/master@{#25289}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25289 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-11-12 10:06:47 +00:00

27 lines
826 B
JavaScript

// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function test(expectation, f) {
var stack;
try {
f();
} catch (e) {
stack = e.stack;
}
print(stack);
assertTrue(stack.indexOf("at eval (evaltest:" + expectation + ")") > 0);
}
test("1:5", new Function(
'1 + reference_error //@ sourceURL=evaltest'));
test("2:6", new Function(
'x', '\n 1 + reference_error //@ sourceURL=evaltest'));
test("2:6", new Function(
'x\n\n', "z//\n", "y", '\n 1 + reference_error //@ sourceURL=evaltest'));
test("1:5", new Function(
'x/*', "z//\n", "y*/", '1 + reference_error //@ sourceURL=evaltest'));
test("2:6", eval(
'(function () {\n 1 + reference_error //@ sourceURL=evaltest\n})'));