2015-04-01 10:11:13 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
2014-11-12 10:06:19 +00:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
assertTrue(stack.indexOf("at eval (evaltest:" + expectation + ")") > 0);
|
|
|
|
}
|
|
|
|
|
2015-04-01 10:11:13 +00:00
|
|
|
/*
|
|
|
|
(function() {
|
2016-02-03 18:45:01 +00:00
|
|
|
1 + reference_error //@ sourceURL=evaltest
|
2015-04-01 10:11:13 +00:00
|
|
|
})
|
|
|
|
*/
|
|
|
|
test("2:5", new Function(
|
2016-02-03 18:45:01 +00:00
|
|
|
'1 + reference_error //@ sourceURL=evaltest'));
|
2015-04-01 10:11:13 +00:00
|
|
|
/*
|
|
|
|
(function(x
|
|
|
|
/\**\/) {
|
|
|
|
|
2016-02-03 18:45:01 +00:00
|
|
|
1 + reference_error //@ sourceURL=evaltest
|
2015-04-01 10:11:13 +00:00
|
|
|
})
|
|
|
|
*/
|
|
|
|
test("4:6", new Function(
|
2016-02-03 18:45:01 +00:00
|
|
|
'x', '\n 1 + reference_error //@ sourceURL=evaltest'));
|
2015-04-01 10:11:13 +00:00
|
|
|
/*
|
|
|
|
(function(x
|
|
|
|
|
|
|
|
,z//
|
|
|
|
,y
|
|
|
|
/\**\/) {
|
|
|
|
|
2016-02-03 18:45:01 +00:00
|
|
|
1 + reference_error //@ sourceURL=evaltest
|
2015-04-01 10:11:13 +00:00
|
|
|
})
|
|
|
|
*/
|
|
|
|
test("7:6", new Function(
|
2016-02-03 18:45:01 +00:00
|
|
|
'x\n\n', "z//\n", "y", '\n 1 + reference_error //@ sourceURL=evaltest'));
|
2015-04-01 10:11:13 +00:00
|
|
|
/*
|
|
|
|
(function(x/\*,z//
|
|
|
|
,y*\/
|
|
|
|
/\**\/) {
|
2016-02-03 18:45:01 +00:00
|
|
|
1 + reference_error //@ sourceURL=evaltest
|
2015-04-01 10:11:13 +00:00
|
|
|
})
|
|
|
|
*/
|
|
|
|
test("4:5", new Function(
|
2016-02-03 18:45:01 +00:00
|
|
|
'x/*', "z//\n", "y*/", '1 + reference_error //@ sourceURL=evaltest'));
|
2015-04-01 10:11:13 +00:00
|
|
|
/*
|
|
|
|
(function () {
|
2016-02-03 18:45:01 +00:00
|
|
|
1 + reference_error //@ sourceURL=evaltest5
|
2015-04-01 10:11:13 +00:00
|
|
|
})
|
|
|
|
*/
|
2014-11-12 10:06:19 +00:00
|
|
|
test("2:6", eval(
|
2016-02-03 18:45:01 +00:00
|
|
|
'(function () {\n 1 + reference_error //@ sourceURL=evaltest\n})'));
|