| Index: tests/co19/test_config.dart
|
| diff --git a/tests/corelib/test_config.dart b/tests/co19/test_config.dart
|
| similarity index 63%
|
| copy from tests/corelib/test_config.dart
|
| copy to tests/co19/test_config.dart
|
| index 8fcaac0577cc30af94693dba068161b3df433233..aff0555c872965637552e389bf0c641791edb178 100644
|
| --- a/tests/corelib/test_config.dart
|
| +++ b/tests/co19/test_config.dart
|
| @@ -2,24 +2,25 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -#library("corelib_test_config");
|
| +#library("co19_test_config");
|
|
|
| #import("../../tools/testing/dart/test_runner.dart");
|
| #import("../../tools/testing/dart/status_file_parser.dart");
|
|
|
| -class CorelibTestSuite {
|
| - String directoryPath = "tests/corelib/src";
|
| - final String statusFilePath = "tests/corelib/corelib.status";
|
| +class Co19TestSuite {
|
| + String directoryPath = "tests/co19/src";
|
| Function doTest;
|
| Function doDone;
|
| String shellPath;
|
| String pathSeparator;
|
| Map configuration;
|
| - TestExpectationsMap testExpectationsMap;
|
| + TestExpectations testExpectations;
|
| + RegExp testRegExp;
|
|
|
| - CorelibTestSuite(Map this.configuration) {
|
| + Co19TestSuite(Map this.configuration) {
|
| shellPath = getDartShellFileName(configuration) ;
|
| pathSeparator = new Platform().pathSeparator();
|
| + testRegExp = new RegExp(@"t[0-9]{2}.dart$");
|
| }
|
|
|
| void forEachTest(Function onTest, [Function onDone = null]) {
|
| @@ -27,24 +28,33 @@ class CorelibTestSuite {
|
| doDone = (ignore) => onDone();
|
|
|
| // Read test expectations from status file.
|
| - testExpectationsMap = ReadTestExpectations(statusFilePath, configuration);
|
| -
|
| - processDirectory();
|
| + testExpectations = new TestExpectations(complexMatching: true);
|
| + ReadTestExpectationsInto(testExpectations,
|
| + "tests/co19/co19-compiler.status",
|
| + configuration);
|
| + ReadTestExpectationsInto(testExpectations,
|
| + "tests/co19/co19-frog.status",
|
| + configuration);
|
| + ReadTestExpectationsInto(testExpectations,
|
| + "tests/co19/co19-runtime.status",
|
| + configuration);
|
| +
|
| + processDirectory(directoryPath);
|
| }
|
|
|
| - void processDirectory() {
|
| - directoryPath = getDirname(directoryPath);
|
| - Directory dir = new Directory(directoryPath);
|
| + void processDirectory(String path) {
|
| + path = getDirname(path);
|
| + Directory dir = new Directory(path);
|
| dir.errorHandler = (s) {
|
| throw s;
|
| };
|
| dir.fileHandler = processFile;
|
| dir.doneHandler = doDone;
|
| - dir.list(false);
|
| + dir.list(recursive: true);
|
| }
|
|
|
| void processFile(String filename) {
|
| - if (!filename.endsWith("Test.dart")) return;
|
| + if (!testRegExp.hasMatch(filename)) return;
|
|
|
| // If patterns are given only list the files that match one of the
|
| // patterns.
|
| @@ -54,12 +64,10 @@ class CorelibTestSuite {
|
| return;
|
| }
|
|
|
| - int start = filename.lastIndexOf(pathSeparator);
|
| - String testName = filename.substring(start + 1, filename.length - 5);
|
| - Set<String> expectations = testExpectationsMap.expectations(testName);
|
| + int start = filename.lastIndexOf('src' + pathSeparator);
|
| + String testName = filename.substring(start + 4, filename.length - 5);
|
| + Set<String> expectations = testExpectations.expectations(testName);
|
|
|
| - // TODO(whesse): Skip files with internal directives, and multipart files,
|
| - // until they are handled correctly.
|
| if (expectations.contains(SKIP)) return;
|
|
|
| List args = ["--ignore-unrecognized-flags"];
|
| @@ -74,6 +82,7 @@ class CorelibTestSuite {
|
| List<List<String>> optionsList = optionsFromFile["vmOptions"];
|
| List<String> dartOptions = optionsFromFile["dartOptions"];
|
| args.addAll(dartOptions == null ? [filename] : dartOptions);
|
| + var isNegative = optionsFromFile["isNegative"];
|
|
|
| if (optionsList.isEmpty()) {
|
| doTest(new TestCase(testName,
|
| @@ -81,7 +90,8 @@ class CorelibTestSuite {
|
| args,
|
| configuration["timeout"],
|
| completeHandler,
|
| - expectations));
|
| + expectations,
|
| + isNegative));
|
| } else {
|
| for (var options in optionsList) {
|
| options.addAll(args);
|
| @@ -90,11 +100,13 @@ class CorelibTestSuite {
|
| options,
|
| configuration["timeout"],
|
| completeHandler,
|
| - expectations));
|
| - }
|
| + expectations,
|
| + isNegative));
|
| + }
|
| }
|
| }
|
|
|
| +
|
| Map testOptions(String filename) {
|
| RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)");
|
| RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)");
|
| @@ -104,6 +116,7 @@ class CorelibTestSuite {
|
|
|
| List<List> result = new List<List>();
|
| List<String> dartOptions;
|
| + bool isNegative = false;
|
| String line;
|
| while ((line = lines.readLine()) != null) {
|
| Match match = testOptionsRegExp.firstMatch(line);
|
| @@ -119,10 +132,19 @@ class CorelibTestSuite {
|
| }
|
| dartOptions = match[1].split(' ').filter((e) => e != '');
|
| }
|
| +
|
| + if (line.contains("@compile-error") || line.contains("@runtime-error")) {
|
| + isNegative = true;
|
| + } else if (line.contains("@dynamic-type-error") &&
|
| + configuration['checked']) {
|
| + isNegative = true;
|
| + }
|
| }
|
| - return {"vmOptions": result, "dartOptions": dartOptions};
|
| + return { "vmOptions": result,
|
| + "dartOptions": dartOptions,
|
| + "isNegative" : isNegative };
|
| }
|
| -
|
| +
|
| void completeHandler(TestCase testCase) {
|
| }
|
| }
|
|
|