Commit a02b7aaa authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[testing] Move the last JS tests out of "preparser".

This moves the last remaining JS file based tests out of the "preparser"
suite. The tests in question all are expected to parse normally and not
throw any exception. This also deprecates the ability of the test suite
to run anything else outside Python templated tests.

R=adamk@chromium.org
TEST=preparser

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

Cr-Commit-Position: refs/heads/master@{#34753}
parent 7a63e0be
......@@ -27,24 +27,26 @@
// Eval restrictions should not trigger outside of strict-mode code.
var arguments = 42;
arguments = arguments++;
arguments += --arguments;
arguments -= ++arguments;
arguments *= arguments--;
function arguments(arguments) {};
try {} catch (arguments) {}
function foo() {
var arguments = 42;
arguments = arguments++;
arguments += --arguments;
arguments -= ++arguments;
arguments *= arguments--;
function arguments(arguments) {};
try {} catch (arguments) {}
function strict() {
"use strict";
// Reading eval and arguments is allowed.
eval(arguments);
}
function strict() {
"use strict";
// Reading eval and arguments is allowed.
eval(arguments);
}
var arguments = 42;
arguments = arguments++;
arguments += --arguments;
arguments -= ++arguments;
arguments *= arguments--;
function arguments(arguments) {};
try {} catch (arguments) {}
var arguments = 42;
arguments = arguments++;
arguments += --arguments;
arguments -= ++arguments;
arguments *= arguments--;
function arguments(arguments) {};
try {} catch (arguments) {}
}
......@@ -27,24 +27,26 @@
// Eval restrictions should not trigger outside of strict-mode code.
var eval = 42;
eval = eval++;
eval += --eval;
eval -= ++eval;
eval *= eval--;
function eval(eval) {};
try {} catch (eval) {}
function foo() {
var eval = 42;
eval = eval++;
eval += --eval;
eval -= ++eval;
eval *= eval--;
function eval(eval) {};
try {} catch (eval) {}
function strict() {
"use strict";
// Reading eval and arguments is allowed.
eval(arguments);
}
function strict() {
"use strict";
// Reading eval and arguments is allowed.
eval(arguments);
}
var eval = 42;
eval = eval++;
eval += --eval;
eval -= ++eval;
eval *= eval--;
function eval(eval) {};
try {} catch (eval) {}
var eval = 42;
eval = eval++;
eval += --eval;
eval -= ++eval;
eval *= eval--;
function eval(eval) {};
try {} catch (eval) {}
}
......@@ -28,13 +28,15 @@
// The with statement is allowed in non-strict code, and even around
// strict code.
with ({}) {}
function foo() {
with ({}) {}
with ({x : 42}) {
var foo = function () {
"use strict";
return x;
};
}
with ({x : 42}) {
var foo = function () {
"use strict";
return x;
};
}
with ({}) {}
with ({}) {}
}
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file contains no JavaScript code.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file contains no identifiers or string literals, but does contain
// symbols.
(function () {
if (this != null) {
return this;
}
while (true) {
if ([][2]) return false;
}
})({}, function() { return [true]; } );
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file contains no function declarations.
var x = 42;
var y = "hello world";
if (x == y) {
with ({ x: 10, y: "20", z: 42 }) {
print(z);
}
}
try {
x = 2;
throw y;
y = 4;
} catch (e) {
y = e;
} finally {
x = y;
}
for (var i = 0; i < 10; i++) {
x += x;
}
print(y);
......@@ -27,17 +27,11 @@
import os
import re
from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.objects import testcase
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
INVALID_FLAGS = ["--enable-slow-asserts"]
class PreparserTestSuite(testsuite.TestSuite):
def __init__(self, name, root):
super(PreparserTestSuite, self).__init__(name, root)
......@@ -70,14 +64,6 @@ class PreparserTestSuite(testsuite.TestSuite):
def ListTests(self, context):
result = []
# Find all .js files in this directory.
filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")]
filenames.sort()
for f in filenames:
flags = [f + ".js"]
test = testcase.TestCase(self, f, flags=flags)
result.append(test)
# Find all .pyt files in this directory.
filenames = [f[:-4] for f in os.listdir(self.root) if f.endswith(".pyt")]
filenames.sort()
......@@ -86,25 +72,11 @@ class PreparserTestSuite(testsuite.TestSuite):
return result
def GetFlagsForTestCase(self, testcase, context):
first = testcase.flags[0]
if first != "-e":
testcase.flags[0] = os.path.join(self.root, first)
source = self.GetSourceForTest(testcase)
result = []
flags_match = re.findall(FLAGS_PATTERN, source)
for match in flags_match:
result += match.strip().split()
result += context.mode_flags
result = [x for x in result if x not in INVALID_FLAGS]
result.append(os.path.join(self.root, testcase.path + ".js"))
return testcase.flags + result
return testcase.flags
def GetSourceForTest(self, testcase):
if testcase.flags[0] == "-e":
return testcase.flags[1]
with open(testcase.flags[0]) as f:
return f.read()
assert testcase.flags[0] == "-e"
return testcase.flags[1]
def _VariantGeneratorFactory(self):
return testsuite.StandardVariantGenerator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment